public abstract class LineAndColumnTracker extends Object
\R pattern of Pattern. Initially, line number and column number are 1.
This class has no public constructors, instead, use one of the static "factory methods".
create()| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_TAB_WIDTH
The default "tab width".
|
| Constructor and Description |
|---|
LineAndColumnTracker() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
consume(char c)
Consumes the next character of the stream.
|
static LineAndColumnTracker |
create() |
abstract int |
getColumnNumber()
Returns the column number of the previously consumed character; 1 after a line separator character has been
consumed, 2 after the first non-line-separator character, and so forth.
|
abstract int |
getLineNumber()
Returns the line number of the previously consumed character (starting at 1).
|
abstract void |
reset()
Resets the current line number to 1 and the current column number to one.
|
abstract void |
setColumnNumber(int columnNumber)
Sets the "current column number" to the given value.
|
abstract void |
setLineNumber(int lineNumber)
Sets the "current line number" to the given value.
|
abstract void |
setTabWidth(int tabWidth)
Reconfigures the TAB width.
|
public static final int DEFAULT_TAB_WIDTH
setTabWidth(int),
Constant Field Valuespublic abstract void setTabWidth(int tabWidth)
1 will treat TAB characters just like any other (non-line-break)
character. The default tab with is DEFAULT_TAB_WIDTH (8).public abstract void consume(char c)
public abstract int getLineNumber()
public abstract void setLineNumber(int lineNumber)
public abstract int getColumnNumber()
public abstract void setColumnNumber(int columnNumber)
public abstract void reset()
tab width remains.)public static LineAndColumnTracker create()
LineAndColumnTracker instanceCopyright © 2023. All rights reserved.