com.android.ide.common.blame
Class SourcePosition

java.lang.Object
  extended by 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.


Field Summary
static SourcePosition UNKNOWN
           
 
Constructor Summary
  SourcePosition(int lineNumber, int column, int offset)
           
  SourcePosition(int startLine, int startColumn, int startOffset, int endLine, int endColumn, int endOffset)
           
protected SourcePosition(SourcePosition copy)
           
 
Method Summary
 int compareEnd(SourcePosition other)
          Compares the end of this SourcePosition with another.
 int compareStart(SourcePosition other)
          Compares the start of this SourcePosition with another.
 boolean equals(java.lang.Object obj)
           
 int getEndColumn()
           
 int getEndLine()
           
 int getEndOffset()
           
 int getStartColumn()
           
 int getStartLine()
           
 int getStartOffset()
           
 int hashCode()
           
 java.lang.String toString()
          Outputs positions as human-readable formatted strings.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

@NonNull
public static final SourcePosition UNKNOWN
Constructor Detail

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)
Method Detail

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