com.unitesk.atp.text.location
Class Position

java.lang.Object
  extended by com.unitesk.atp.text.location.Position
Direct Known Subclasses:
OffsetPosition

public class Position
extends Object

Text position is specified by line and column. Valid lines and columns are counted from 1.

Version:
$Id: Position.java,v 1.3 2004/11/15 07:53:05 all-x Exp $
Author:
Alexey Demakov

Constructor Summary
Position()
          Stub constructor sets line and column in (0,0).
Position(int line, int column)
          Creates position with the specified line and column.
 
Method Summary
 boolean equals(Object obj)
          Positions are equal if lines and columns are equal.
 int getColumn()
          Returns the column of this position.
 int getLine()
          Returns the line of this position.
 int hashCode()
           
 void setColumn(int column)
          Sets the new value of column of this position.
 void setLine(int line)
          Sets the new value of line of this position.
 String toString()
          Returns the string representation of this position.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Position

public Position()
Stub constructor sets line and column in (0,0). They are stub values because real lines and columns are counted from 1.


Position

public Position(int line,
                int column)
Creates position with the specified line and column.

Parameters:
line - The line of new position.
column - The column of new position.
Method Detail

getLine

public int getLine()
Returns the line of this position.

Returns:
The line of this position.

setLine

public void setLine(int line)
Sets the new value of line of this position.

Parameters:
line - value to be set as line.

getColumn

public int getColumn()
Returns the column of this position.

Returns:
The column of this position.

setColumn

public void setColumn(int column)
Sets the new value of column of this position.

Parameters:
column - value to be set as column.

toString

public String toString()
Returns the string representation of this position.

Overrides:
toString in class Object
Returns:
The string representation of this position as "(${line},${column})". Invalid (non-positive) value of line or column is represented as '?'.

equals

public boolean equals(Object obj)
Positions are equal if lines and columns are equal.

Overrides:
equals in class Object
Parameters:
obj - The object to compare with.

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
This implementation returns line of position.


Copyright © 2001-2006 ISP RAS, RedVerst Group. All Rights Reserved.