cs132.util
Class SourcePos

java.lang.Object
  extended by cs132.util.SourcePos

public final class SourcePos
extends Object


Field Summary
 int column
           
 int line
           
 
Constructor Summary
SourcePos(int line, int column)
           
 
Method Summary
 String toString()
           
 void toString(StringBuilder builder)
           
 String toStringRelative(SourcePos other)
          Shows this location relative to another location.
 void toStringRelative(StringBuilder builder, SourcePos other)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

line

public final int line

column

public final int column
Constructor Detail

SourcePos

public SourcePos(int line,
                 int column)
Method Detail

toString

public void toString(StringBuilder builder)

toString

public String toString()
Overrides:
toString in class Object

toStringRelative

public String toStringRelative(SourcePos other)
Shows this location relative to another location. If the two locations are on different lines, this function behaves the same as toString() does. Otherwise, only the column number is shown.


toStringRelative

public void toStringRelative(StringBuilder builder,
                             SourcePos other)