Class Lookahead2Iterator<E>
- java.lang.Object
-
- com.singularsys.jep.configurableparser.Lookahead2Iterator<E>
-
- Direct Known Subclasses:
LookaheadNIterator
public class Lookahead2Iterator<E> extends java.lang.ObjectAn iterator which stores the next two tokens.
-
-
Constructor Summary
Constructors Constructor Description Lookahead2Iterator()Default constructor.Lookahead2Iterator(java.util.Iterator<E> input)Decerator constructor around an iteratorLookahead2Iterator(java.util.List<E> input)Constructor when the list of tokens is known beforehand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume()Eat one token.Enextnext()EpeekNext()Eprev()Return the token just consumed.voidsetInputIterator(java.util.Iterator<E> input)Should be called if the default constructor is used.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Lookahead2Iterator
public Lookahead2Iterator()
Default constructor. If this constructor is used then thesetInputIterator(Iterator)method should be called.- Since:
- 3.5
-
Lookahead2Iterator
public Lookahead2Iterator(java.util.List<E> input)
Constructor when the list of tokens is known beforehand.- Parameters:
input- the list of tokens
-
Lookahead2Iterator
public Lookahead2Iterator(java.util.Iterator<E> input)
Decerator constructor around an iterator- Parameters:
input- the input itterator
-
-
Method Detail
-
setInputIterator
public void setInputIterator(java.util.Iterator<E> input)
Should be called if the default constructor is used.- Parameters:
input- the new input itterator- Since:
- 3.5
-
peekNext
public E peekNext()
-
nextnext
public E nextnext()
-
prev
public E prev()
Return the token just consumed.- Returns:
- the token, or null if no token consumed.
- Since:
- Jep 3.5
-
consume
public void consume()
Eat one token.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-