Package org.ec4j.core.parser
Class Location
java.lang.Object
org.ec4j.core.parser.Location
An immutable object that represents a location in the parsed text.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
column
private final int columnThe column number, starting at 1. -
line
private final int lineThe line number, starting at 1. -
offset
private final int offsetThe absolute character index, starting at 0.
-
-
Constructor Details
-
Location
public Location(int offset, int line, int column)
-
-
Method Details
-
parse
Parses aLocationfrom aStringthat has the format defined bytoString(). Should make it easier to write tests.- Parameters:
locationString- the location string to parse- Returns:
- a new
Locationparsed out of the givenlocationString
-
equals
-
getColumn
public int getColumn()- Returns:
- the column number, the first column is
1
-
getLine
public int getLine()- Returns:
- the line number, the first line is
1
-
getOffset
public int getOffset()- Returns:
- an absolute index within the file; the first offset is
0
-
hashCode
public int hashCode() -
toString
-