Package com.android.ide.common.blame
Class SourcePosition
java.lang.Object
com.android.ide.common.blame.SourcePosition
- All Implemented Interfaces:
java.io.Serializable
public final class SourcePosition
extends java.lang.Object
implements java.io.Serializable
An immutable position in a text file, used in errors to point the user to an issue.
Positions that are unknown are represented by -1.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static SourcePositionUNKNOWN -
Constructor Summary
Constructors Modifier Constructor Description SourcePosition(int lineNumber, int column, int offset)SourcePosition(int startLine, int startColumn, int startOffset, int endLine, int endColumn, int endOffset)protectedSourcePosition(SourcePosition copy) -
Method Summary
Modifier and Type Method Description intcompareEnd(SourcePosition other)Compares the end of this SourcePosition with another.intcompareStart(SourcePosition other)Compares the start of this SourcePosition with another.booleanequals(java.lang.Object obj)static SourcePositionfromString(java.lang.String string)Given the human-readable formatted string, returns a source position object.intgetEndColumn()intgetEndLine()intgetEndOffset()intgetStartColumn()intgetStartLine()intgetStartOffset()inthashCode()java.lang.StringtoString()Outputs positions as human-readable formatted strings.
-
Field Details
-
Constructor Details
-
SourcePosition
public SourcePosition(int startLine, int startColumn, int startOffset, int endLine, int endColumn, int endOffset) -
SourcePosition
public SourcePosition(int lineNumber, int column, int offset) -
SourcePosition
-
-
Method Details
-
toString
public java.lang.String toString()Outputs positions as human-readable formatted strings. e.g.84 84-86 84:5 84:5-28 85:5-86:47
- Overrides:
toStringin classjava.lang.Object- Returns:
- a human readable position.
-
fromString
Given the human-readable formatted string, returns a source position object. -
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
getStartLine
public int getStartLine() -
getStartColumn
public int getStartColumn() -
getStartOffset
public int getStartOffset() -
getEndLine
public int getEndLine() -
getEndColumn
public int getEndColumn() -
getEndOffset
public int getEndOffset() -
compareStart
Compares the start of this SourcePosition with another.- Returns:
- 0 if they are the same, < 0 if this < other and > 0 if this > other
-
compareEnd
Compares the end of this SourcePosition with another.- Returns:
- 0 if they are the same, < 0 if this < other and > 0 if this > other
-