edu.ksu.cis.projects.bogor.ast
Class LocationInfo

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.LocationInfo
All Implemented Interfaces:
Disposable, Serializable

public final class LocationInfo
extends Object
implements Disposable, Serializable

This class is used to store location information in a file.

Version:
CVS $Revision: 1.3 $ $Date: 2004/09/14 04:07:37 $
Author:
Robby
See Also:
Serialized Form

Constructor Summary
LocationInfo()
          Default constructor.
LocationInfo(Node parent)
          Constructor with parent.
 
Method Summary
 void copyInfoFrom(LocationInfo other)
          Copy info from another location info.
 void dispose()
          Removes reference to parent.
 boolean equals(Object o)
          Checks whether this object is equal to another object.
 int getColumn1()
          Gets the start column number.
 int getColumn2()
          Gets the start position.
 int getLine1()
          Gets the start line number.
 int getLine2()
          Gets the end line number.
 Object getParent()
          Gets the parent of this object.
 int hashCode()
          Gets the hash code of this object.
 void setColumn1(int newColumn1)
          Sets the start column number.
 void setColumn2(int newColumn2)
          Sets the end column number.
 void setLine1(int newLine1)
          Sets the start position.
 void setLine2(int newLine2)
          Sets the end line number.
 void setParent(Node newParent)
          Sets the parent of this object.
 String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocationInfo

public LocationInfo()
Default constructor.


LocationInfo

public LocationInfo(Node parent)
Constructor with parent.

Parameters:
parent - The parent of this object. Must be non-null.
Method Detail

setColumn1

public void setColumn1(int newColumn1)
Sets the start column number.

Parameters:
newColumn1 - The new start column number. Must be greater than zero.

getColumn1

public int getColumn1()
Gets the start column number.

Returns:
The start column number. Greater than zero.

setColumn2

public void setColumn2(int newColumn2)
Sets the end column number.

Parameters:
newColumn2 - int. The new end column number. Must be greater than zero.

getColumn2

public int getColumn2()
Gets the start position.

Returns:
The start position. Greater than or equal to zero.

setLine1

public void setLine1(int newLine1)
Sets the start position.

Parameters:
newPos1 - The new start position. Must be greater than or equal zero.

getLine1

public int getLine1()
Gets the start line number.

Returns:
The start line number. Greater than zero.

setLine2

public void setLine2(int newLine2)
Sets the end line number.

Parameters:
newLine2 - int. The new end line number. Must be greater than zero.

getLine2

public int getLine2()
Gets the end line number.

Returns:
The end line number. Greater than zero.

setParent

public void setParent(Node newParent)
Sets the parent of this object.

Parameters:
newParent - The new parent. Must be non-null.

getParent

public Object getParent()
Gets the parent of this object.

Returns:
The parent of this object.

copyInfoFrom

public void copyInfoFrom(LocationInfo other)
Copy info from another location info.

Parameters:
other - Another location info to copy info from. Must be non-null.

dispose

public void dispose()
Removes reference to parent. Once called, avoid using this object.

Specified by:
dispose in interface Disposable

equals

public boolean equals(Object o)
Checks whether this object is equal to another object.

Overrides:
equals in class Object
Parameters:
o - Another object to check equality to.
Returns:
True, if the contained info are the same. False, otherwise.

hashCode

public int hashCode()
Gets the hash code of this object.

Overrides:
hashCode in class Object
Returns:
(line1 << 15) + line2 + (column1 << 15) + column2

toString

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

Overrides:
toString in class Object
Returns:
"[(pos1, pos2)]:[(line1, column1), (line2, column2)]"