A position in a document, including line and column.
More...
Inherits Comparable< Position >.
|
| int | compareTo (Position o) |
| | Compare two positions according to their order of appearance in a document (first according to line, then according to column).
|
| boolean | equals (Object obj) |
| int | getOneBasedColumn () |
| | Return the one-based column number described by this Position.
|
| int | getOneBasedLine () |
| | Return the one-based line number described by this Position.
|
| int | getZeroBasedColumn () |
| | Return the zero-based column number described by this Position.
|
| int | getZeroBasedLine () |
| | Return the zero-based line number described by this Position.
|
| int | hashCode () |
| Position | minus (Position other) |
| | Return the difference of this and another Position.
|
| Position | plus (Position other) |
| | Return the sum of this and another Position.
|
| Position | plus (String text) |
| | Return the Position that equals the displacement of ((text whose displacement equals this) concatenated with text).
|
| String | toString () |
|
| static Position | displacementOf (String text) |
| | Return the Position that equals the displacement caused by text, assuming that text starts in column 0.
|
| static Position | fromOffset (int offset, String content) |
| | Return the Position that describes the same location in content as offset.
|
| static Position | fromOneBased (int line, int column) |
| | Return the Position that describes the given one-based line and column numbers.
|
| static Position | fromString (String s) |
| | Return the Position represented by s.
|
| static Position | fromZeroBased (int line, int column) |
| | Return the Position that describes the given zero-based line and column numbers.
|
| static String | removeNamedCapturingGroups (Pattern regex) |
| | Remove the names from the named capturing groups that appear in regex.
|
A position in a document, including line and column.
This position may be relative to some position other than the origin.
- Author
- Peter Donovan
◆ compareTo()
| int org.lflang.generator.Position.compareTo |
( |
Position | o | ) |
|
Compare two positions according to their order of appearance in a document (first according to line, then according to column).
◆ displacementOf()
| Position org.lflang.generator.Position.displacementOf |
( |
String | text | ) |
|
|
static |
Return the Position that equals the displacement caused by text, assuming that text starts in column 0.
- Parameters
-
- Returns
- the Position that equals the displacement caused by text
◆ equals()
| boolean org.lflang.generator.Position.equals |
( |
Object | obj | ) |
|
◆ fromOffset()
| Position org.lflang.generator.Position.fromOffset |
( |
int | offset, |
|
|
String | content ) |
|
static |
Return the Position that describes the same location in content as offset.
- Parameters
-
| offset | a location, expressed as an offset from the beginning of content |
| content | the content of a document |
- Returns
- the Position that describes the same location in content as offset
◆ fromOneBased()
| Position org.lflang.generator.Position.fromOneBased |
( |
int | line, |
|
|
int | column ) |
|
static |
Return the Position that describes the given one-based line and column numbers.
- Parameters
-
| line | the one-based line number |
| column | the one-based column number |
- Returns
- a Position describing the position described by line and column.
◆ fromString()
| Position org.lflang.generator.Position.fromString |
( |
String | s | ) |
|
|
static |
Return the Position represented by s.
- Parameters
-
- Returns
- the Position represented by s
◆ fromZeroBased()
| Position org.lflang.generator.Position.fromZeroBased |
( |
int | line, |
|
|
int | column ) |
|
static |
Return the Position that describes the given zero-based line and column numbers.
- Parameters
-
| line | the zero-based line number |
| column | the zero-based column number |
- Returns
- a Position describing the position described by line and column.
◆ getOneBasedColumn()
| int org.lflang.generator.Position.getOneBasedColumn |
( |
| ) |
|
Return the one-based column number described by this Position.
- Returns
- the one-based column number described by this Position
◆ getOneBasedLine()
| int org.lflang.generator.Position.getOneBasedLine |
( |
| ) |
|
Return the one-based line number described by this Position.
- Returns
- the one-based line number described by this Position
◆ getZeroBasedColumn()
| int org.lflang.generator.Position.getZeroBasedColumn |
( |
| ) |
|
Return the zero-based column number described by this Position.
- Returns
- the zero-based column number described by this Position
◆ getZeroBasedLine()
| int org.lflang.generator.Position.getZeroBasedLine |
( |
| ) |
|
Return the zero-based line number described by this Position.
- Returns
- the zero-based line number described by this Position
◆ hashCode()
| int org.lflang.generator.Position.hashCode |
( |
| ) |
|
◆ minus()
| Position org.lflang.generator.Position.minus |
( |
Position | other | ) |
|
Return the difference of this and another Position.
The result has meaning because Positions are relative.
- Parameters
-
- Returns
- the difference of this and other
◆ plus() [1/2]
| Position org.lflang.generator.Position.plus |
( |
Position | other | ) |
|
Return the sum of this and another Position.
The result has meaning because Positions are relative.
- Parameters
-
- Returns
- the sum of this and other
◆ plus() [2/2]
| Position org.lflang.generator.Position.plus |
( |
String | text | ) |
|
Return the Position that equals the displacement of ((text whose displacement equals this) concatenated with text).
Note that this is not necessarily equal to (this + displacementOf(text)).
- Parameters
-
- Returns
- the Position that equals the displacement caused by text
◆ removeNamedCapturingGroups()
| String org.lflang.generator.Position.removeNamedCapturingGroups |
( |
Pattern | regex | ) |
|
|
static |
Remove the names from the named capturing groups that appear in regex.
- Parameters
-
| regex | an arbitrary regular expression |
- Returns
- a string representation of regex with the names removed from the named capturing groups
◆ toString()
| String org.lflang.generator.Position.toString |
( |
| ) |
|
◆ ORIGIN
◆ PATTERN
| final Pattern org.lflang.generator.Position.PATTERN = Pattern.compile("\\((?<line>[0-9]+), (?<column>[0-9]+)\\)") |
|
static |
The documentation for this class was generated from the following file:
- /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/Position.java