koala.dynamicjava.tree
Class SourceInfo

java.lang.Object
  extended by koala.dynamicjava.tree.SourceInfo
All Implemented Interfaces:
Comparable<SourceInfo>

public final class SourceInfo
extends Object
implements Comparable<SourceInfo>

A simple tuple class to represent source location.


Nested Class Summary
static interface SourceInfo.Wrapper
           
 
Field Summary
static SourceInfo NONE
           
 
Method Summary
 int compareTo(SourceInfo that)
           
 boolean equals(Object obj)
          Method for determining the equality of two source locations - overriden from Object The method for determining if two source locations are equal is as follows: The two Files must be equal using the File.equals method The integers for the corresponding Start/End Line/Column must be identical
static SourceInfo extend(SourceInfo.Wrapper wrapper, int endLine, int endColumn)
           
static SourceInfo extend(SourceInfo si, int endLine, int endColumn)
           
 int getEndColumn()
           
 int getEndLine()
           
 File getFile()
          May be null, if the source file is unknown.
 String getFilename()
          Get the file's name, or "(no file)".
 int getStartColumn()
           
 int getStartLine()
           
 int hashCode()
           
static SourceInfo point(File f, int line, int column)
           
static SourceInfo prepend(int startLine, int startColumn, SourceInfo.Wrapper wrapper)
           
static SourceInfo prepend(int startLine, int startColumn, SourceInfo si)
           
static SourceInfo range(File f, int startLine, int startColumn, int endLine, int endColumn)
           
static SourceInfo span(SourceInfo.Wrapper first, SourceInfo.Wrapper second)
           
static SourceInfo span(SourceInfo.Wrapper first, SourceInfo second)
           
static SourceInfo span(SourceInfo first, SourceInfo.Wrapper second)
           
static SourceInfo span(SourceInfo first, SourceInfo second)
           
 String toString()
          Returns a string representation of the source information.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final SourceInfo NONE
Method Detail

point

public static SourceInfo point(File f,
                               int line,
                               int column)

range

public static SourceInfo range(File f,
                               int startLine,
                               int startColumn,
                               int endLine,
                               int endColumn)

extend

public static SourceInfo extend(SourceInfo si,
                                int endLine,
                                int endColumn)

extend

public static SourceInfo extend(SourceInfo.Wrapper wrapper,
                                int endLine,
                                int endColumn)

prepend

public static SourceInfo prepend(int startLine,
                                 int startColumn,
                                 SourceInfo si)

prepend

public static SourceInfo prepend(int startLine,
                                 int startColumn,
                                 SourceInfo.Wrapper wrapper)

span

public static SourceInfo span(SourceInfo first,
                              SourceInfo second)

span

public static SourceInfo span(SourceInfo first,
                              SourceInfo.Wrapper second)

span

public static SourceInfo span(SourceInfo.Wrapper first,
                              SourceInfo second)

span

public static SourceInfo span(SourceInfo.Wrapper first,
                              SourceInfo.Wrapper second)

getFile

public File getFile()
May be null, if the source file is unknown. TODO: Change this interface to Option.


getFilename

public String getFilename()
Get the file's name, or "(no file)".


getStartLine

public int getStartLine()

getStartColumn

public int getStartColumn()

getEndLine

public int getEndLine()

getEndColumn

public int getEndColumn()

toString

public String toString()
Returns a string representation of the source information. The format is as following: [fileName: (startLine,startColumn)-(endLine,endColumn)] If there is no file then fileName is "(no file)"

Overrides:
toString in class Object
Returns:
The string format of the source info

equals

public boolean equals(Object obj)
Method for determining the equality of two source locations - overriden from Object The method for determining if two source locations are equal is as follows: The two Files must be equal using the File.equals method The integers for the corresponding Start/End Line/Column must be identical

Overrides:
equals in class Object
Returns:
Whether or not the two SourceInfo objects are equal

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(SourceInfo that)
Specified by:
compareTo in interface Comparable<SourceInfo>