public class Position extends Object implements Comparable<Position>
Modifier and Type | Field and Description |
---|---|
static int |
ABSOLUTE_BEGIN_LINE
Line numbers must be positive, thus
|
static int |
ABSOLUTE_END_LINE |
int |
column |
static int |
FIRST_COLUMN
The first column -- note that it is 1-indexed (i.e. the first column is column 1, as opposed to 0)
|
static int |
FIRST_LINE
The first line -- note that it is 1-indexed (i.e. the first line is line 1, as opposed to 0)
|
static Position |
HOME
The first position in the file.
|
int |
line |
Constructor and Description |
---|
Position(int line,
int column)
TODO: Do we refer to the characters as columns,
...or the spaces between (thus also before/after) characters as columns?
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Position otherPosition) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
invalid() |
boolean |
isAfter(Position otherPosition) |
boolean |
isAfterOrEqual(Position otherPosition) |
boolean |
isBefore(Position otherPosition) |
boolean |
isBeforeOrEqual(Position otherPosition) |
Position |
nextLine() |
Position |
orIfInvalid(Position alternativePosition) |
static Position |
pos(int line,
int column)
Deprecated.
Use the constructor (e.g.
new Position(line, column) ) |
Position |
right(int characters) |
String |
toString() |
boolean |
valid()
Check if the position is usable.
|
Position |
withColumn(int column) |
Position |
withLine(int line) |
public final int line
public final int column
public static final int FIRST_LINE
public static final int FIRST_COLUMN
public static final Position HOME
public static final int ABSOLUTE_BEGIN_LINE
public static final int ABSOLUTE_END_LINE
public Position(int line, int column)
@Deprecated public static Position pos(int line, int column)
new Position(line, column)
)public Position withColumn(int column)
public Position withLine(int line)
public Position right(int characters)
public Position nextLine()
public boolean valid()
public Position orIfInvalid(Position alternativePosition)
public boolean isAfter(Position otherPosition)
public boolean isAfterOrEqual(Position otherPosition)
public boolean isBefore(Position otherPosition)
public boolean isBeforeOrEqual(Position otherPosition)
public int compareTo(Position otherPosition)
compareTo
in interface Comparable<Position>
Copyright © 2007–2022. All rights reserved.