# Interface: com.pnfsoftware.jeb.core.units.code.IControlFlowGraph

Generic interface for control flow graph \(CFG\) objects.

## Method: addressableInstructions
- return type: `java.lang.Iterable<com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>>`

Description: Get an instruction\-with\-address iterator. Also see [#instructions()](#instructions()).
return: an iterator \(not supporting [remove](Iterator#remove())\)

## Method: get
- parameter: `index`, type: `int`
- return type: `Block`

Description: Retrieve a basic block.
parameter: index: block index
return: basic block

## Method: getBlock
- parameter: `index`, type: `int`
- return type: `Block`

Description: Get a basic block.
parameter: index: block index
return: basic block

## Method: getBlockAt
- parameter: `address`, type: `long`
- return type: `Block`

Description: Get the basic block that starts at the provided address or offset.
parameter: address: the block address/offset
return: basic block, or null if none starts at that address

## Method: getBlockByLastAddress
- parameter: `address`, type: `long`
- return type: `Block`

Description: Get the basic block whose last address is the provided address.
parameter: address: last instruction address
return: basic block, or null

## Method: getBlockContaining
- parameter: `address`, type: `long`
- return type: `Block`

Description: Get the basic block that contains the provided address. 

 Note that the address just needs to be in the block address range; it does not need to point to the beginning of an instruction within the block
parameter: address: an address within the block
return: containing block, or null

## Method: getBlockEndingAt
- parameter: `address`, type: `long`
- return type: `Block`

Description: Get the basic block that ends on the provided address.
parameter: address: wanted block end address \(exclusive\)
return: basic block, or null if none ends at that address

## Method: getBlocks
- return type: `java.util.List<Block>`

Description: Get a copy of the block list of the CFG. The list is ordered by ascending block address. Modifying the list does not impact the CFG.
return: a copy of the list of blocks

## Method: getBlocksView
- return type: `java.util.List<Block>`

Description: Get a read\-only view of the list of blocks for this CFG. The list is ordered by ascending block address.
return: the list of blocks

## Method: getEffectiveSize
- return type: `int`

Description: Calculate the 'effective' size of this CFG, that is, the sum of the size of each basic block.
return: the CFG size

## Method: getEndAddress
- return type: `long`

Description: Routine highest address \(exclusive\).
return: end address

## Method: getEntryAddress
- return type: `long`

Description: Routine entry\-point address. Note that this address may not be the lowest one in the CFG.
return: the address of the entry block

## Method: getEntryBlock
- return type: `Block`

Description: Get the entry block. The entry block is unique.
return: never null; the method throws on error

## Method: getExitBlocks
- return type: `java.util.List<Block>`

Description: Get the ordered list of exit blocks. A CFG may have zero or more exit blocks; CFG representing standard routines will have at least one \(generally one\) exit block.
return: a collection of blocks, possibly empty

## Method: getFirstAddress
- return type: `long`

Description: Routine lowest address \(inclusive\). Note that this address may not be the entry\-point address for this routine.
return: first address

## Method: getGraphRepresentation
- parameter: `edges`, type: `java.util.List<int[]>`
- parameter: `irregularEdges`, type: `java.util.List<int[]>`

Description: Get the a graph representation of the CFG. The list of edges use a 1\-based node numbering scheme.
parameter: edges: \(output\) array of regular edges, eg: {{1,2},{1,3},{2,3}}
parameter: irregularEdges: \(output\) array of irregular edges

## Method: getInstruction
- parameter: `address`, type: `long`
- return type: `InsnType`

Description: Get the instruction located at the exact address.
parameter: address: instruction address
return: an instruction, null if none

## Method: getInstructionCount
- return type: `int`

Description: Get the total number of instructions in the CFG. This method sums the number of instructions of each block of the CFG.
return: instruction count

## Method: getInstructionLocation
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.util.base.Couple<Block,java.lang.Integer>`

Description: Locate an instruction.
parameter: address: instruction address
return: a couple \(basic block, instruction index within that block\); null on error

## Method: getInstructions
- return type: `java.util.List<InsnType>`

Description: Get the instruction list of this CFG by aggregating each instruction of every block. The list is ordered by ascending address/offset.
return: instruction list

## Method: getLast
- return type: `Block`

Description: Get the last block.
return: last block

## Method: getLastAddress
- return type: `long`

Description: Routine highest address \(inclusive\).
return: last address

## Method: indexOf
- parameter: `b`, type: `Block`
- return type: `int`

Description: Get the index of a basic block.
parameter: b: basic block
return: block index, or \-1

## Method: instructions
- return type: `java.lang.Iterable<InsnType>`

Description: Get an instruction iterator. Also see [#addressableInstructions()](#addressableInstructions()).
return: an iterator \(not supporting [remove](Iterator#remove())\)

## Method: size
- return type: `int`

Description: Get the number of blocks.
return: block count

