public final class Position extends Object
The position contains the line, column and filename where the token occurred. The file name is optional.
| Modifier and Type | Field and Description |
|---|---|
private int |
column
Column of occurrence.
|
private String |
file
File of the source string.
|
private int |
line
Line of occurrence.
|
static Position |
NULL
A position for line 0 and column 0.
|
| Constructor and Description |
|---|
Position(int line,
int column)
Initializes without file.
|
Position(int line,
int column,
String file)
Dedicated constructor initializes immutable object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getColumn()
Returns column of occurrence in source.
|
String |
getFile()
Returns the file name of the source.
|
int |
getLine()
Returns line of occurrence in source.
|
int |
hashCode() |
String |
toString()
Returns human readable string representation.
|
public static final Position NULL
private final String file
private final int line
private final int column
public Position(int line,
int column)
line - Line of occurrence.column - Column of occurrence.public Position(int line,
int column,
String file)
line - must be greater than -1column - must be greater than -1file - must not be null, may be emptypublic String getFile()
public int getLine()
public int getColumn()
public String toString()
Copyright © 2014 Sven Strittmatter. All Rights Reserved.