Class TextPos2d
- java.lang.Object
-
- net.sourceforge.pmd.lang.document.TextPos2d
-
- All Implemented Interfaces:
Comparable<TextPos2d>
public final class TextPos2d extends Object implements Comparable<TextPos2d>
A place in a text document, represented as line/column information.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(@NonNull TextPos2d that)
Compares the start offset, then the length of a region.boolean
equals(Object o)
int
getColumn()
Returns the (1-based) column number.int
getLine()
Returns the (1-based) line number.int
hashCode()
static TextPos2d
pos2d(int line, int column)
Builds a new region from offset and length.String
toDisplayStringInEnglish()
Returns a string looking like"line 2, column 4")
.String
toDisplayStringWithColon()
Returns a string looking like"2:4")
.String
toString()
String
toTupleString()
Returns a string looking like"(line=2, column=4)"
.
-
-
-
Method Detail
-
getLine
public int getLine()
Returns the (1-based) line number.
-
getColumn
public int getColumn()
Returns the (1-based) column number.
-
pos2d
public static TextPos2d pos2d(int line, int column)
Builds a new region from offset and length.- Throws:
AssertionError
- If either parameter is negative
-
compareTo
public int compareTo(@NonNull TextPos2d that)
Compares the start offset, then the length of a region.- Specified by:
compareTo
in interfaceComparable<TextPos2d>
-
toTupleString
public String toTupleString()
Returns a string looking like"(line=2, column=4)"
.
-
toDisplayStringInEnglish
public String toDisplayStringInEnglish()
Returns a string looking like"line 2, column 4")
.
-
toDisplayStringWithColon
public String toDisplayStringWithColon()
Returns a string looking like"2:4")
.
-
-