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

Customizable CFG formatter. 

 Sub\-classes are permitted. Protected methods `genXxx()` may be overridden to customize rendering.

## Constructor: CFGFormatter
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG<InsnType>`

Description: Legacy CFG formatter. Variables/registers/bits in data chains are represented by their ids.
parameter: cfg: a CFG

## Constructor: CFGFormatter
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG<InsnType>`
- parameter: `varprv`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.IVariableProvider`
- parameter: `formatFineGrained`, type: `boolean`

Description: Build a CFG formatter with an optional variable provider to aid in the representation of data chains.
parameter: cfg: a CFG
parameter: varprv: optional variable provider
parameter: formatFineGrained: N/A if varprv is null; else, determine if the chains should be            represented fine grained \(partial variable use is explicitly shown\), or coarse            grained \(any bit of a variable being used will be represented as a full variable            use\)

## Static Field: cfgfwccnt
Type: `java.util.concurrent.atomic.AtomicInteger`
Description: Performance counter reserved for internal use.

## Method: format
- parameter: `formatAddresses`, type: `boolean`
- parameter: `formatChains`, type: `boolean`
- parameter: `formatInOut`, type: `boolean`
- parameter: `dfa`, type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`
- parameter: `fcf`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.IFormattingContextFactory<InsnType>`
- return type: `java.lang.String`

Description: Format the CFG into a printable string, with optional data chains.
parameter: formatAddresses: true to prepend instructions by their address
parameter: formatChains: true to format data chains
parameter: formatInOut: true to format the input and output chains
parameter: dfa: DFA object
parameter: fcf: optional context generator for instructions
return: the formatted CFG

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

Description: Convenience method. Format a CFG without any chain.
return: 

## Protected Method: genAddress
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation generates `ADDRESS/SIZE`.

## Protected Method: genAddressCharacter
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `i`, type: `int`

Description: The default implementation generates one of:
 `: (default) > (entry) + (block) * (handler) v (branching down) ^ (branching up)`

## Protected Method: genBOL
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation does nothing.

## Protected Method: genEOL
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation appends a New Line \(`\n`\) character.

## Protected Method: genHeader
- parameter: `sb`, type: `java.lang.StringBuilder`

Description: The default implementation does nothing.

## Protected Method: genPostAddress
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation appends 2 spaces.

## Protected Method: genPostChains
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation appends spaces to pad the current line to 2000 characters \(or more\).

## Protected Method: genPostInstruction
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation appends spaces to pad the current line to 120 characters \(or more\).

## Protected Method: genPreAddress
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation does nothing.

## Protected Method: genPreChains
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation does nothing.

## Protected Method: genPreInstruction
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`

Description: The default implementation does nothing.

## Protected Method: genTrailer
- parameter: `sb`, type: `java.lang.StringBuilder`

Description: The default implementation does nothing.

## Method: getCfg
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG<InsnType>`


## Protected Method: padLine
- parameter: `sb`, type: `java.lang.StringBuilder`
- parameter: `alignLen`, type: `int`


## Static Method: formatChains
- parameter: `chains`, type: `java.util.Map<java.lang.Integer,java.util.Collection<T>>`
- parameter: `varprv`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.IVariableProvider`
- return type: `java.lang.String`


