com.android.ide.common.blame
Class SourcePosition
java.lang.Object
com.android.ide.common.blame.SourcePosition
@Immutable
public final class SourcePosition
- extends java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
UNKNOWN
@NonNull
public static final SourcePosition UNKNOWN
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
protected SourcePosition(SourcePosition copy)
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:
toString
in class java.lang.Object
- Returns:
- a human readable position.
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.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
public int compareStart(@NonNull
SourcePosition other)
- 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
public int compareEnd(@NonNull
SourcePosition other)
- Compares the end of this SourcePosition with another.
- Returns:
- 0 if they are the same, < 0 if this < other and > 0 if this > other