de.smartics.util.source
Class SourceCodeLocation.Position

Package class diagram package SourceCodeLocation.Position
java.lang.Object
  extended by de.smartics.util.source.SourceCodeLocation.Position
All Implemented Interfaces:
Serializable, Comparable< SourceCodeLocation.Position>
Enclosing class:
SourceCodeLocation

public static class SourceCodeLocation.Position
     
     
extends Object
implements Serializable, Comparable< SourceCodeLocation.Position>

Defines a position in the source code.

See Also:
Serialized Form
To Do:
Serial: check validity of lines and columns when read from stream.

Constructor Summary
SourceCodeLocation.Position(long line, long column)
          Default constructor.
 
Method Summary
 int compareTo(SourceCodeLocation.Position other)
          
 boolean equals(Object object)
          Returns true if the given object is semantically equal to the given object, false otherwise.
 long getColumn()
          Returns the column number of the position.
 long getLine()
          Returns the line number of the position.
 int hashCode()
          Returns the hash code of the object.
 String toString()
          Delegates call to StringBuilder.toString().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourceCodeLocation.Position

public SourceCodeLocation.Position(long line,
                                   long column)
                            throws IllegalArgumentException
Default constructor.

Parameters:
line - the line number of the position.
column - the column number of the position.
Throws:
IllegalArgumentException - if line or column is smaller than 1.
Method Detail

getLine

public long getLine()
Returns the line number of the position. The lines start by 1.

Returns:
the line number of the position.

getColumn

public long getColumn()
Returns the column number of the position. The columns start by 1.

Returns:
the column number of the position.

compareTo

public int compareTo(SourceCodeLocation.Position other)

Specified by:
compareTo in interface Comparable<SourceCodeLocation.Position>

hashCode

public int hashCode()
Returns the hash code of the object.

Overrides:
hashCode in class Object
Returns:
the hash code.

equals

public boolean equals(Object object)
Returns true if the given object is semantically equal to the given object, false otherwise.

Overrides:
equals in class Object
Parameters:
object - the instance to compare to.
Returns:
true if the given object is semantically equal to the given object, false otherwise.

toString

public String toString()
Delegates call to StringBuilder.toString().

Overrides:
toString in class Object
See Also:
StringBuilder.toString()
Returns:
the result of the call to StringBuilder.toString().


Copyright © 2011-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.