org.qedeq.kernel.bo.parser
Class MementoTextInput

java.lang.Object
  extended by org.qedeq.kernel.bo.parser.MementoTextInput

public class MementoTextInput
extends java.lang.Object

Remember TextInput positions.

Author:
Michael Meyling

Constructor Summary
MementoTextInput(TextInput input)
          Constructor.
 
Method Summary
 void clearMark()
          Forget last remembered position.
 int getChar()
          Reads a single character and does not change the reading position.
 int getColumn()
          Returns the current column number.
 java.lang.String getLine()
          Returns the current line.
 long getPosition()
          Get byte position.
 int getRewindStackSize()
          Get rewind stack size.
 int getRow()
          Returns the current line number.
 boolean isEmpty()
          Are there still any characters to read?
 void markPosition()
          Remember current position.
 int read()
          Reads a single character and increments the reading position by one.
 int readInverse()
          Decrements the reading position by one and reads a single character.
 long rewindPosition()
          Rewind to previous marked position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MementoTextInput

public MementoTextInput(TextInput input)
Constructor.

Parameters:
input - Input source to parse.
Method Detail

markPosition

public void markPosition()
Remember current position.


rewindPosition

public long rewindPosition()
Rewind to previous marked position. Also clears the mark.

Returns:
Current position before pop.

clearMark

public void clearMark()
Forget last remembered position.


getPosition

public long getPosition()
Get byte position.

Returns:
Position.

getChar

public int getChar()
Reads a single character and does not change the reading position.

Returns:
character read, if there are no more chars -1 is returned

read

public int read()
Reads a single character and increments the reading position by one.

Returns:
character read, if there are no more chars -1 is returned

isEmpty

public final boolean isEmpty()
Are there still any characters to read?

Returns:
Anything left for reading further?

getRewindStackSize

public int getRewindStackSize()
Get rewind stack size.

Returns:
Rewind stack size.

getColumn

public int getColumn()
Returns the current column number.

Returns:
Current column number (starting with line 1).

getRow

public int getRow()
Returns the current line number.

Returns:
Current line number (starting with line 1).

getLine

public java.lang.String getLine()
Returns the current line.

Returns:
Current line.

readInverse

public int readInverse()
Decrements the reading position by one and reads a single character. If no characters are left, -1 is returned. Otherwise a cast to char gives the character read.

Returns:
Character read, if there are no more chars -1 is returned.


Copyright © 2014. All Rights Reserved.