org.waxeye.input
Class InputBuffer

java.lang.Object
  extended by org.waxeye.input.InputBuffer
All Implemented Interfaces:
IParserInput

public final class InputBuffer
extends java.lang.Object
implements IParserInput

A class to represent the buffer to hold the input string.

Author:
Orlando Hill

Field Summary
 
Fields inherited from interface org.waxeye.input.IParserInput
EOF
 
Constructor Summary
InputBuffer(char[] input)
          Creates a new InputBuffer for the given char[].
 
Method Summary
 int consume()
          Gets the next character from the input and moves the position forward 1.
 boolean equals(java.lang.Object object)
          
 int getInputSize()
          Returns the inputSize.
 int getPosition()
          Gets the position marker in the input.
 int hashCode()
          
 int peek()
          Gets the next character from the input but maintains the position.
 void setPosition(int position)
          Sets the position of the input buffer to the given value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputBuffer

public InputBuffer(char[] input)
Creates a new InputBuffer for the given char[]. The position starts at index 0.

Parameters:
input - The char[] to use for our buffer.
Method Detail

consume

public int consume()
Gets the next character from the input and moves the position forward 1.

Specified by:
consume in interface IParserInput
Returns:
The next character or EOF if end of input reached.

peek

public int peek()
Gets the next character from the input but maintains the position.

Specified by:
peek in interface IParserInput
Returns:
The next character or EOF if end of input reached.

getPosition

public int getPosition()
Gets the position marker in the input.

Specified by:
getPosition in interface IParserInput
Returns:
Returns the position marker in the input.

getInputSize

public int getInputSize()
Returns the inputSize.

Returns:
Returns the inputSize.

setPosition

public void setPosition(int position)
Sets the position of the input buffer to the given value. If the value given is less than 0 then the position is set to 0.

Specified by:
setPosition in interface IParserInput
Parameters:
position - The position to set.

equals

public boolean equals(java.lang.Object object)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object


Waxeye Parser Generator