# Class: com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock

This class represents a basic block of generic instructions.

## Constructor: BasicBlock
- parameter: `base`, type: `long`

Description: Create a new empty basic block.

## Constructor: BasicBlock
- parameter: `base`, type: `long`
- parameter: `insns`, type: `java.util.List<InsnType>`
- parameter: `dstOffsets`, type: `java.util.List<java.lang.Long>`
- parameter: `irrdstOffsets`, type: `java.util.List<java.lang.Long>`
- parameter: `unknownDst`, type: `boolean`

Description: Create a new basic block.
parameter: base: 
parameter: insns: 
parameter: dstOffsets: 
parameter: irrdstOffsets: 
parameter: unknownDst: 

## Method: add
- parameter: `insn`, type: `InsnType`

Description: **DANGEROUS METHOD.** Append an instruction to the block. 

 The instruction is appended to the block. The edges are not updated.
 The caller is responsible for verifying the instruction \(no null, no dup., etc.\).
 The caller is responsible for maintaining the consistency of the block and of the CFG.
parameter: insn: the instruction to be appended

## Method: add
- parameter: `index`, type: `int`
- parameter: `insn`, type: `InsnType`

Description: **DANGEROUS METHOD.** Add an instruction into the block.
parameter: index: 
parameter: insn: 

## Method: addAll
- parameter: `coll`, type: `java.util.Collection<InsnType>`

Description: **DANGEROUS METHOD.** Append instructions to the block. 

 The instructions are appended to the block. The edges are not updated.
 The caller is responsible for verifying the instructions \(no null, no dup., etc.\).
 The caller is responsible for maintaining the consistency of the block and of the CFG.
parameter: coll: 

## Method: addAll
- parameter: `index`, type: `int`
- parameter: `coll`, type: `java.util.Collection<InsnType>`

Description: **DANGEROUS METHOD.** Add instructions into the block.
parameter: index: 
parameter: coll: 

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


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


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


## Method: canThrow
- return type: `boolean`


## Method: compareTo
- parameter: `o`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- return type: `int`


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


## Method: get2
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>`

Description: Get the instruction at the specified index, in an addressable form.
parameter: index: 
return: 

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


## Method: getAddressOfInstruction
- parameter: `index`, type: `int`
- return type: `long`


## Method: getAddresses
- return type: `long[]`

Description: Get a list of the addresses of each instruction in the block.
return: 

## Method: getAllInputBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getAllInputs
- return type: `java.lang.Iterable<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getAllOutputBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getAllOutputs
- return type: `java.lang.Iterable<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


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


## Method: getBranchingInstruction2
- parameter: `includeBreaking`, type: `boolean`
- parameter: `includeCalling`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>`

Description: Retrieve the branching instruction, if any. In the general case, it should not be assumed that the branching instruction must be the last instruction of a block. Example: on delay\-slot architectures, a number of instructions may follow the branching instructions. They are included in the block. That means that the branching instruction, when there is one, may be the one/two/Nth\-before\-last.
parameter: includeBreaking: 
parameter: includeCalling: 
return: the branching instruction\+address, or null if none

## Method: getBranchingInstruction2
- return type: `com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>`

Description: Same as [getBranchingInstruction2\(true, true\)](#getBranchingInstruction2(boolean, boolean)).

## Method: getData
- parameter: `name`, type: `java.lang.String`
- return type: `java.lang.Object`

Description: May return null if the custom object does not exist.

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


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


## Method: getIndexOfInstruction
- parameter: `address`, type: `long`
- return type: `int`


## Method: getIndexOfInstruction
- parameter: `insn`, type: `InsnType`
- return type: `int`

Description: Locate an instruction in the block. Comparison is done by identity.
parameter: insn: 
return: the instruction index, \-1 if not found

## Method: getInputBlock
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`


## Method: getInputBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getInputOffsets
- return type: `java.util.List<java.lang.Long>`


## Method: getInputs
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`

Description: Retrieve a read\-only list of input blocks \(regular\). 

 NOTE: This method is faster than [#getInputBlocks()](#getInputBlocks()) since it does not provide a copy of the list.
return: 

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


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


## Method: getIrregularInputBlock
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`


## Method: getIrregularInputBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getIrregularInputOffsets
- return type: `java.util.List<java.lang.Long>`


## Method: getIrregularInputs
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`

Description: Retrieve a read\-only list of irregular input blocks. 

 NOTE: This method is faster than [#getIrregularInputBlocks()](#getIrregularInputBlocks()) since it does not provide a copy of the list.
return: 

## Method: getIrregularOutputBlock
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`


## Method: getIrregularOutputBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getIrregularOutputOffsets
- return type: `java.util.List<java.lang.Long>`


## Method: getIrregularOutputs
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


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

Description: Get the last instruction of the block. 

 **Keep in mind that a branching instruction may NOT be the last instruction of a basic block if it supports delay\-slots.**
return: 

## Method: getLast2
- return type: `com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>`

Description: Get the last instruction of the block, in an addressable form. 

 **Keep in mind that a branching instruction may NOT be the last instruction of a basic block if it supports delay\-slots.**
return: 

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


## Method: getOutputBlock
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`


## Method: getOutputBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


## Method: getOutputOffsets
- return type: `java.util.List<java.lang.Long>`


## Method: getOutputs
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`


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


## Method: hasUnknownDst
- return type: `boolean`


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


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


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


## Method: isEmpty
- return type: `boolean`


## Method: isInfiniteLoop
- return type: `boolean`

Description: Check if the block has a single regular out\-edge which points to itself.
return: 

## Method: isSelfReferencing
- return type: `boolean`

Description: Check if the block has at least one regular out\-edge pointing to itself.
return: 

## Method: iterator
- return type: `java.util.Iterator<InsnType>`


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


## Method: remove
- parameter: `index`, type: `int`
- return type: `boolean`

Description: Remove an instruction from the block as well as associated chains. **Usage is not recommended for public clients.** 

 This method may have the nasty side\-effect of making the block empty. In that case, it returns true, and it is the caller's responsibility to refresh the CFG at their earliest convenience. 

 Another issue the client needs to take care of is the removal of the last instruction, which should only happen on very specific conditions, since the trailing instruction typically conditions the out\-edges of the block.
parameter: index: 
return: true if the CFG need refreshing

## Method: removeData
- parameter: `name`, type: `java.lang.String`
- return type: `boolean`


## Method: set
- parameter: `index`, type: `int`
- parameter: `insn`, type: `InsnType`
- return type: `InsnType`

Description: **DANGEROUS METHOD.** Replace an instruction. Sizes must match. 

 Edges are not updated.
 The caller is responsible for maintaining the consistency of the block and of the CFG.
parameter: index: 
parameter: insn: the instruction
return: the instruction that was replaced

## Method: setData
- parameter: `name`, type: `java.lang.String`
- parameter: `object`, type: `java.lang.Object`

Description: Custom data is reset when a DFA is invalidated.

## Method: setLast
- parameter: `insn`, type: `InsnType`
- return type: `InsnType`


## Method: setUnknownDst
- parameter: `unknownDst`, type: `boolean`


## Method: shallowCopy
- parameter: `copyBlockReferences`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`

Description: Shallow duplication of a basic block. USE THE RESULTING BLOCK WITH CAUTION. \- Instructions references are copied
 \- Block references \(edges\) are optionally copied \(the blocks are not\)
 \- DFA data is not copied
parameter: copyBlockReferences: 
return: a new block

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


## Method: toString
- return type: `java.lang.String`


