Class CodeUtil
java.lang.Object
com.pnfsoftware.jeb.core.units.code.CodeUtil
Utility routines for code units.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<ICodeClass> collectClasses(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter) Deprecated.Kept for legacystatic List<ICodeClass> collectClasses(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter, boolean fullMatch) Collect classes.static List<ICodeMethod> collectMethods(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter) Deprecated.Kept for legacystatic List<ICodeMethod> collectMethods(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter, boolean fullMatch) Collect methods.static IAddressableDigraphBuilderCreate a call graph builder for a code unit.static StringfindCodeItemReference(ICodeUnit unit, ICodeItem item, int pos) Find a reference to a code item.static ICodeFieldgetFieldByName(ICodeUnit unit, String partialName, boolean failIfAmbiguous) Get a field by name.static ICodeMethodgetMethodByName(ICodeUnit unit, String partialName, boolean failIfAmbiguous) Get a method/routine by name.
-
Method Details
-
findCodeItemReference
Find a reference to a code item.- Parameters:
unit- code unititem- code itempos- reference index- Returns:
- reference address, or null
-
getMethodByName
public static ICodeMethod getMethodByName(ICodeUnit unit, String partialName, boolean failIfAmbiguous) Get a method/routine by name.- Parameters:
unit- code unitpartialName- full or partial method namefailIfAmbiguous- true to fail on ambiguous partial matches- Returns:
- matching method, or null
-
getFieldByName
public static ICodeField getFieldByName(ICodeUnit unit, String partialName, boolean failIfAmbiguous) Get a field by name.- Parameters:
unit- code unitpartialName- full or partial field namefailIfAmbiguous- true to fail on ambiguous partial matches- Returns:
- matching field, or null
-
collectClasses
@Deprecated public static List<ICodeClass> collectClasses(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter) Deprecated.Kept for legacyCollect classes.- Parameters:
unit- code unitinternal- true to collect internal classes onlytopLevel- true to collect non-inner classes onlyaddressFilter- optional address filter- Returns:
- collected classes
-
collectClasses
public static List<ICodeClass> collectClasses(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter, boolean fullMatch) Collect classes.- Parameters:
unit-ICodeUnitcontaining classes (seeICodeUnit.getClasses()internal- true to collect internal classes onlytopLevel- true to collect non-inner classes onlyaddressFilter- optional filter onICodeItem.getAddress()fullMatch- true if pattern must match the entire addresses. false if we only intend a search into the address.- Returns:
- collected classes
-
collectMethods
@Deprecated public static List<ICodeMethod> collectMethods(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter) Deprecated.Kept for legacyCollect methods.- Parameters:
unit- code unitinternal- true to collect internal methods onlytopLevel- true to collect orphaned methods onlyaddressFilter- optional address filter- Returns:
- collected methods
-
collectMethods
public static List<ICodeMethod> collectMethods(ICodeUnit unit, boolean internal, boolean topLevel, Pattern addressFilter, boolean fullMatch) Collect methods.- Parameters:
unit-ICodeUnitcontaining methods (seeICodeUnit.getMethods()internal- true to collect internal methods onlytopLevel- true to collect orphaned methods only (not belonging to any class)addressFilter- optional filter onICodeItem.getAddress()fullMatch- true if pattern must match the entire addresses. false if we only intend a search into the address.- Returns:
- collected methods
-
createCallgraphBuilder
Create a call graph builder for a code unit.- Parameters:
unit- code unit- Returns:
- call graph builder, or null
-