Package EDU.purdue.jtb.parser.syntaxtree
Class NodeList
- java.lang.Object
-
- EDU.purdue.jtb.parser.syntaxtree.NodeList
-
public class NodeList extends java.lang.Object implements INodeList
Represents a grammar list (+), e.g. ' ( A )+ '.
The class stores the nodes list in an ArrayList.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NodeList()Initializes an empty list of nodes with a default first allocation.NodeList(int sz)Initializes an empty list of nodes with a given allocation.NodeList(int sz, INode firstNode)Initializes an empty list of nodes with a given allocation and adds a first node.NodeList(INode firstNode)Initializes an empty list of nodes with a default first allocation and adds a first node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaccept(IIntVisitor vis)Accepts aIIntVisitorvisitor with user return data.voidaccept(IVoidVisitor vis)Accepts aIVoidVisitorvisitor} visitor with user return data.voidaddNode(INode n)Adds a node to the list of nodes, managing progressive allocation increments.INodeelementAt(int i)Gets the node in the list at a given position.java.util.Iterator<INode>elements()Returns an iterator on the nodes list.intsize()Returns the number of nodes in the list.
-
-
-
Field Detail
-
nodes
public java.util.ArrayList<INode> nodes
The list of nodes
-
-
Constructor Detail
-
NodeList
public NodeList()
Initializes an empty list of nodes with a default first allocation.
-
NodeList
public NodeList(int sz)
Initializes an empty list of nodes with a given allocation.- Parameters:
sz- - the list size
-
NodeList
public NodeList(INode firstNode)
Initializes an empty list of nodes with a default first allocation and adds a first node.- Parameters:
firstNode- - the node to add
-
NodeList
public NodeList(int sz, INode firstNode)Initializes an empty list of nodes with a given allocation and adds a first node.- Parameters:
sz- - the list sizefirstNode- - the node to add
-
-
Method Detail
-
addNode
public void addNode(INode n)
Adds a node to the list of nodes, managing progressive allocation increments.
-
elementAt
public INode elementAt(int i)
Gets the node in the list at a given position.
-
elements
public java.util.Iterator<INode> elements()
Returns an iterator on the nodes list.
-
size
public int size()
Returns the number of nodes in the list.
-
accept
public int accept(IIntVisitor vis)
Accepts aIIntVisitorvisitor with user return data.
-
accept
public void accept(IVoidVisitor vis)
Accepts aIVoidVisitorvisitor} visitor with user return data.
-
-