# Class: com.pnfsoftware.jeb.core.output.code.CodeDocumentPart

A document part specific to code outputs. Use with [CodeDocument](CodeDocument) Remember to call [#registerAnchor](#registerAnchor) before generating content at a given anchor point. 

 The type of ILine used is [CodeLine](CodeLine). The type of IAnchor used is [CodeAnchor](CodeAnchor). 

 Clients must extend this class.

## Constructor: CodeDocumentPart
- parameter: `baseAnchorId`, type: `long`

Description: Create a new code document part, attached to the given anchor. An 8\-space padding and a 4\-space indentation is selected by default.
parameter: baseAnchorId: the base anchor identifier

## Method: append
- parameter: `s`, type: `java.lang.String`
- parameter: `aActualInsertionIndex`, type: `int[]`

Description: Append a chunk of text to the current line. The line should not contain CR/LF characters.
parameter: s: chunk of text, should not contain CR or LF characters. If found, they are replaced            by slash \('/'\) characters
parameter: aActualInsertionIndex: optional: set the index of the inserted string \(can be different            from current index because of padding\) at 0\-index

## Method: append
- parameter: `s`, type: `java.lang.String`


## Method: append
- parameter: `str`, type: `java.lang.String`
- parameter: `classId`, type: `com.pnfsoftware.jeb.core.output.ItemClassIdentifiers`


## Method: appendAndRecord
- parameter: `s`, type: `java.lang.String`
- parameter: `classId`, type: `com.pnfsoftware.jeb.core.output.ItemClassIdentifiers`

Description: Append a chunk of text to the current line.
parameter: s: a string
parameter: classId: a class identifier

## Method: appendAndRecord
- parameter: `s`, type: `java.lang.String`
- parameter: `classId`, type: `com.pnfsoftware.jeb.core.output.ItemClassIdentifiers`
- parameter: `itemId`, type: `long`

Description: Append a chunk of text to the current line.
parameter: s: a string
parameter: classId: a class identifier
parameter: itemId: an item identifier

## Method: appendAndRecord
- parameter: `s`, type: `java.lang.String`
- parameter: `classId`, type: `com.pnfsoftware.jeb.core.output.ItemClassIdentifiers`
- parameter: `itemId`, type: `long`
- parameter: `flags`, type: `int`

Description: Append a chunk of text to the current line.
parameter: s: a string
parameter: classId: a class identifier
parameter: itemId: an item identifier
parameter: flags: flags

## Method: appendComment
- parameter: `text`, type: `java.lang.String`


## Method: appendComment
- parameter: `text`, type: `java.lang.String`
- parameter: `auto`, type: `boolean`


## Method: appendCommentAuto
- parameter: `text`, type: `java.lang.String`


## Protected Method: appendKeyword
- parameter: `id`, type: `int`


## Method: appendKeyword
- parameter: `keyword`, type: `java.lang.String`


## Method: appendKeyword
- parameter: `keyword`, type: `java.lang.String`
- parameter: `itemId`, type: `long`


## Method: appendMulti
- parameter: `s`, type: `java.lang.String`


## Method: appendParameterSeparator

Description: Append a parameter separator to the current line. Use [#setParameterSeparator(String)](#setParameterSeparator(String)) to override default.

## Method: brace


## Method: braceClose


## Method: bracket


## Method: bracketClose


## Method: decrementIndentationLevel


## Method: disablePadding


## Method: enablePadding


## Method: eol
- parameter: `lineCoord`, type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`

Description: End the current line.
parameter: lineCoord: optional chunk coordinates

## Method: eol

Description: End the current line.

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


## Method: getAnchor
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.output.code.CodeAnchor`


## Method: getAnchors
- return type: `java.util.List<com.pnfsoftware.jeb.core.output.code.CodeAnchor>`


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


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


## Method: getCurrentAnchor
- return type: `com.pnfsoftware.jeb.core.output.code.CodeAnchor`

Description: Get the currently active anchor.
return: the last registered anchor

## Method: getCurrentCoordinates
- return type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`


## Method: getCurrentLine
- return type: `com.pnfsoftware.jeb.core.output.code.CodeLine`

Description: Get the last \(unfinished\) line
return: the last line

## Method: getCurrentLineCoordinates
- return type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`


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

Description: Same as [#getLineCount()](#getLineCount()).
return: the line count

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


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


## Method: getCurrentMostPreciseCodeCoordinates
- return type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`


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


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


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

Description: Get the index of the last **finished** line.
return: the last finished line index

## Method: getLine
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.output.code.CodeLine`


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

Description: Get the number of finished \(EOL\-terminated\) lines in this part. A line is finished by calling eol\(\).
return: the number of lines, excluding the last \(unfinished\) line

## Method: getLines
- return type: `java.util.List<com.pnfsoftware.jeb.core.output.code.CodeLine>`


## Method: getObjectLocations
- return type: `java.util.List<com.pnfsoftware.jeb.core.output.text.ObjectLocation>`


## Method: incrementIndentationLevel


## Method: indentReset


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


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


## Method: moveLastLine
- parameter: `newIndex`, type: `int`
- return type: `boolean`


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


## Method: paren


## Method: parenClose


## Method: prependCodePart
- parameter: `part`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: recordCurrentCoordinates
- parameter: `coordinates`, type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`


## Method: recordLineCoordinates
- parameter: `coordinates`, type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`


## Method: recordObjectLocation
- parameter: `object`, type: `java.lang.Object`
- parameter: `begin`, type: `boolean`
- parameter: `depth`, type: `int`


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

Description: Create an anchor using the current \(next\) anchor id, and register it at the current last line.
parameter: name: the anchor name
return: true if the anchor was successfully registered

## Method: registerAnchor
- parameter: `anchorId`, type: `long`
- parameter: `name`, type: `java.lang.String`
- return type: `boolean`

Description: Create an anchor with the provided anchor id, and register it at the current last line.
parameter: anchorId: anchor identifier to register
parameter: name: optional anchor name
return: true if the anchor was successfully registered

## Protected Method: registerKeyword
- parameter: `keyword`, type: `java.lang.String`
- return type: `int`

Description: Register a keyword for future fast appending. Use for frequent keywords to bypass some internal checks.
parameter: keyword: a keyword ".", ";" for example...
return: the id of the keyword;

## Method: resetPaddingString


## Method: setIndentationLevel
- parameter: `level`, type: `int`


## Method: setIndentationString
- parameter: `indentString`, type: `java.lang.String`


## Method: setPaddingString
- parameter: `paddingString`, type: `java.lang.String`


## Method: setParameterSeparator
- parameter: `parameterSeparator`, type: `java.lang.String`

Description: Set the parameter separator. Default is ", ".
parameter: parameterSeparator: new parameter separator

## Method: space

Description: Append a space to the current line.

## Method: space
- parameter: `cnt`, type: `int`

Description: Append one or more spaces to the current line.
parameter: cnt: the number of spaces to be appended; may be `<= 0`, in which case, this            method will do nothing

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


## Method: unrecordCurrentCoordinates


## Method: unrecordLineCoordinates


## Method: validate


## Static Method: enableTokenFlattening
- parameter: `enabled`, type: `boolean`
- return type: `boolean`

Description: Enable or disable token flattening. This method is reserved for internal use. Refer to the Engines property `FlattenStringsInCodeDocuments` if you wish to modify whether tokens should be flattened when they are appended to a text document.
parameter: enabled: new token\-flattening setting
return: the previous setting

