scanner
Class CharStreamPosition

java.lang.Object
  extended byscanner.CharStreamPosition
All Implemented Interfaces:
java.lang.Cloneable

public class CharStreamPosition
extends java.lang.Object
implements java.lang.Cloneable

This class defines positions in a stream of characters.


Constructor Summary
CharStreamPosition()
          Creates a new position with default values (column=1, line=1, offset=0).
CharStreamPosition(CharStreamPosition pos)
          Creates a new position a the same place as the given one.
CharStreamPosition(int column, int line, int charactersOffset)
          Creates a new position at the specified place.
 
Method Summary
 java.lang.Object clone()
          Returns a new position at the same place as this one.
 int getCharactersOffset()
          Returns the character offset.
 int getColumn()
          Returns the column of this position.
 int getLine()
          Returns the line of this position.
 void setCharactersOffset(int charactersOffset)
          Sets the offset of this position.
 void setColumn(int column)
          Sets the column of this position.
 void setLine(int line)
          Sets the line of this position.
 void setPosition(CharStreamPosition pos)
          Sets this position to the same place as the specified one.
 void setPosition(int column, int line, int offset)
          Sets this position to the specified place.
 java.lang.String toString()
          Returns a string representation this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CharStreamPosition

public CharStreamPosition()
Creates a new position with default values (column=1, line=1, offset=0).


CharStreamPosition

public CharStreamPosition(CharStreamPosition pos)
Creates a new position a the same place as the given one.

Parameters:
pos - The position to be take as reference to create this new position.

CharStreamPosition

public CharStreamPosition(int column,
                          int line,
                          int charactersOffset)
Creates a new position at the specified place.

Parameters:
column - This position's column.
line - This position's line.
charactersOffset - This position's offset.
Method Detail

setPosition

public void setPosition(CharStreamPosition pos)
Sets this position to the same place as the specified one.

Parameters:
pos - The position where this one has to be set.

setPosition

public void setPosition(int column,
                        int line,
                        int offset)
Sets this position to the specified place.

Parameters:
column - This position's new colum.
line - This position's new line.
offset - This position's new offset.

setColumn

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

Parameters:
column - This position's new colum.

setLine

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

Parameters:
line - This position's new line.

setCharactersOffset

public void setCharactersOffset(int charactersOffset)
Sets the offset of this position.

Parameters:
charactersOffset - The character offset to be applied to this position.

getColumn

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

Returns:
The column of this position.

getLine

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

Returns:
The line of this position.

getCharactersOffset

public int getCharactersOffset()
Returns the character offset.

Returns:
The character offset. Character offset is equal to zero for the first character.

clone

public java.lang.Object clone()
Returns a new position at the same place as this one.

Returns:
A new position at the same place as this one.

toString

public java.lang.String toString()
Returns a string representation this object.

Returns:
A string representation this object.