Object-oriented Parser System
v3.6

oops3
Class Parser.Node

Object
  extended by AbstractCollection<E>
      extended by AbstractList<Parser.Node>
          extended by Parser.Node
All Implemented Interfaces:
Serializable, Iterable<Parser.Node>, Collection<Parser.Node>, List<Parser.Node>
Direct Known Subclasses:
Parser.Binding, Parser.Group, Parser.Nonterminal, Parser.Terminal
Enclosing class:
Parser

public abstract class Parser.Node
extends AbstractList<Parser.Node>
implements Serializable

basic behavior for the grammar tree: an immutable List with lookahead.

See Also:
Serialized Form

Field Summary
protected  int lookahead
          references Parser.lookaheads.
protected  int position
          position associated with node.
 
Fields inherited from class AbstractList
modCount
 
Constructor Summary
protected Parser.Node(int position, int lookahead)
           
 
Method Summary
 Parser.Node get(int index)
          needs to be overridden when there are descendants.
 BitSet getLookahead()
          throws an exception if Lookahead has not been run or if lookahead was initialized out of range.
 int getPosition()
           
 int size()
          needs to be overridden when there are descendants.
abstract  Object visit(Visitor visitor)
          implements divide and conquer for Visitor.
 
Methods inherited from class AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

position

protected int position
position associated with node. This is only changed in Rule.init after a forward declaration.


lookahead

protected final int lookahead
references Parser.lookaheads.

Constructor Detail

Parser.Node

protected Parser.Node(int position,
                      int lookahead)
Method Detail

getPosition

public int getPosition()

getLookahead

public BitSet getLookahead()
throws an exception if Lookahead has not been run or if lookahead was initialized out of range.

See Also:
Parser.Pattern

get

public Parser.Node get(int index)
needs to be overridden when there are descendants.

Specified by:
get in interface List<Parser.Node>
Specified by:
get in class AbstractList<Parser.Node>
Throws:
IndexOutOfBoundsException

size

public int size()
needs to be overridden when there are descendants.

Specified by:
size in interface Collection<Parser.Node>
Specified by:
size in interface List<Parser.Node>
Specified by:
size in class AbstractCollection<Parser.Node>
Returns:
0

visit

public abstract Object visit(Visitor visitor)
implements divide and conquer for Visitor. Body must be return visitor.visit(this);.



(c) 2008 Axel T. Schreiner