Package EDU.purdue.jtb.parser.syntaxtree
Class NodeSequence
java.lang.Object
EDU.purdue.jtb.parser.syntaxtree.NodeSequence
- All Implemented Interfaces:
INode
,INodeList
,Serializable
Represents a sequence of nodes (x y z ...) nested within a choice (|), list (+),
optional list (*), or optional node (? or []), e.g. ' ( A B )+ ' or ' [ C D E ] '.
The class stores the nodes list in an ArrayList.
The class stores the nodes list in an ArrayList.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitializes an emptyNodeSequence
with a default allocation.NodeSequence
(int sz) Initializes an emptyNodeSequence
with a given allocation.NodeSequence
(int sz, INode firstNode) Initializes an emptyNodeSequence
with a given allocation and adds a first node.NodeSequence
(INode firstNode) Initializes an emptyNodeSequence
with a default allocation and adds a first node. -
Method Summary
Modifier and TypeMethodDescriptionint
accept
(IIntVisitor vis) Accepts aIIntVisitor
visitor with user return data.void
accept
(IVoidVisitor vis) Accepts aIVoidVisitor
visitor} visitor with user return data.void
Adds a node to theNodeSequence
.elementAt
(int i) Gets the node in the list at a given position.elements()
Returns an iterator on the nodes list.int
size()
Returns the number of nodes in the list.
-
Field Details
-
nodes
The list of nodes
-
-
Constructor Details
-
NodeSequence
public NodeSequence()Initializes an emptyNodeSequence
with a default allocation. -
NodeSequence
public NodeSequence(int sz) Initializes an emptyNodeSequence
with a given allocation.- Parameters:
sz
- - the list size
-
NodeSequence
Initializes an emptyNodeSequence
with a default allocation and adds a first node.- Parameters:
firstNode
- - the node to add
-
NodeSequence
Initializes an emptyNodeSequence
with a given allocation and adds a first node.- Parameters:
sz
- - the list sizefirstNode
- - the node to add
-
-
Method Details
-
addNode
Adds a node to theNodeSequence
. -
elementAt
Gets the node in the list at a given position. -
elements
Returns an iterator on the nodes list. -
size
public int size()Returns the number of nodes in the list. -
accept
Accepts aIIntVisitor
visitor with user return data. -
accept
Accepts aIVoidVisitor
visitor} visitor with user return data.
-