# Class: com.pnfsoftware.jeb.core.units.code.CodeUtil

Utility routines for code units.

## Static Method: collectClasses
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `internal`, type: `boolean`
- parameter: `topLevel`, type: `boolean`
- parameter: `addressFilter`, type: `java.util.regex.Pattern`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.ICodeClass>`

Description: Collect classes.
parameter: unit: code unit
parameter: internal: true to collect internal classes only
parameter: topLevel: true to collect non\-inner classes only
parameter: addressFilter: optional address filter
return: collected classes
deprecated: Kept for legacy

## Static Method: collectClasses
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `internal`, type: `boolean`
- parameter: `topLevel`, type: `boolean`
- parameter: `addressFilter`, type: `java.util.regex.Pattern`
- parameter: `fullMatch`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.ICodeClass>`

Description: Collect classes.
parameter: unit: [ICodeUnit](ICodeUnit) containing classes \(see [ICodeUnit#getClasses()](ICodeUnit#getClasses())
parameter: internal: true to collect internal classes only
parameter: topLevel: true to collect non\-inner classes only
parameter: addressFilter: optional filter on [ICodeClass#getAddress()](ICodeClass#getAddress())
parameter: fullMatch: true if pattern must match the entire addresses. false if we only intend a            search into the address.
return: collected classes

## Static Method: collectMethods
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `internal`, type: `boolean`
- parameter: `topLevel`, type: `boolean`
- parameter: `addressFilter`, type: `java.util.regex.Pattern`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.ICodeMethod>`

Description: Collect methods.
parameter: unit: code unit
parameter: internal: true to collect internal methods only
parameter: topLevel: true to collect orphaned methods only
parameter: addressFilter: optional address filter
return: collected methods
deprecated: Kept for legacy

## Static Method: collectMethods
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `internal`, type: `boolean`
- parameter: `topLevel`, type: `boolean`
- parameter: `addressFilter`, type: `java.util.regex.Pattern`
- parameter: `fullMatch`, type: `boolean`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.ICodeMethod>`

Description: Collect methods.
parameter: unit: [ICodeUnit](ICodeUnit) containing methods \(see [ICodeUnit#getMethods()](ICodeUnit#getMethods())
parameter: internal: true to collect internal methods only
parameter: topLevel: true to collect orphaned methods only \(not belonging to any class\)
parameter: addressFilter: optional filter on [ICodeMethod#getAddress()](ICodeMethod#getAddress())
parameter: fullMatch: true if pattern must match the entire addresses. false if we only intend a            search into the address.
return: collected methods

## Static Method: createCallgraphBuilder
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- return type: `com.pnfsoftware.jeb.util.graph.IAddressableDigraphBuilder`

Description: Create a call graph builder for a code unit.
parameter: unit: code unit
return: call graph builder, or null

## Static Method: findCodeItemReference
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `item`, type: `com.pnfsoftware.jeb.core.units.code.ICodeItem`
- parameter: `pos`, type: `int`
- return type: `java.lang.String`

Description: Find a reference to a code item.
parameter: unit: code unit
parameter: item: code item
parameter: pos: reference index
return: reference address, or null

## Static Method: getFieldByName
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `partialName`, type: `java.lang.String`
- parameter: `failIfAmbiguous`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.ICodeField`

Description: Get a field by name.
parameter: unit: code unit
parameter: partialName: full or partial field name
parameter: failIfAmbiguous: true to fail on ambiguous partial matches
return: matching field, or null

## Static Method: getMethodByName
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`
- parameter: `partialName`, type: `java.lang.String`
- parameter: `failIfAmbiguous`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.ICodeMethod`

Description: Get a method/routine by name.
parameter: unit: code unit
parameter: partialName: full or partial method name
parameter: failIfAmbiguous: true to fail on ambiguous partial matches
return: matching method, or null

