|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxtc.tree.Node
xtc.parser.Element
xtc.parser.Sequence
public class Sequence
A sequence of grammar elements.
A sequence may have an optional name. However, this name is not considered when comparing sequences for equality.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class xtc.parser.Element |
|---|
Element.Tag |
| Field Summary | |
|---|---|
java.util.List<Element> |
elements
The ordered list of grammar elements. |
SequenceName |
name
The optional name. |
| Constructor Summary | |
|---|---|
Sequence()
Create a new, empty sequence. |
|
Sequence(Element element)
Create a new sequence with the specified element. |
|
Sequence(int capacity)
Create a new, empty sequence with the specified capacity. |
|
Sequence(java.util.List<Element> elements)
Create a new sequence. |
|
Sequence(SequenceName name,
java.util.List<Element> elements)
Create a new sequence. |
|
| Method Summary | |
|---|---|
Sequence |
add(Element e)
Add the specified element to this sequence. |
Sequence |
addAll(java.util.List<Element> l)
Add all elements in the specified list to this sequence. |
Sequence |
clear()
Remove all elements from this sequence. |
static Sequence |
ensure(Element e)
Ensure that the specified element is a sequence. |
boolean |
equals(java.lang.Object o)
|
Element |
get(int idx)
Get the element at the specified index. |
int |
hashCode()
|
boolean |
hasTrailingChoice()
Determine whether this sequence's last element is an ordered choice. |
boolean |
isEmpty()
Determine whether this sequence is empty. |
int |
size()
Get the size of this sequence. |
Sequence |
subSequence(int start)
Create a new subsequence from the specified start index. |
Sequence |
subSequence(int start,
int end)
Create a new subsequence for the specified indices. |
Element.Tag |
tag()
Get this element's tag. |
void |
write(java.lang.Appendable out)
Write a human readable representation to the specified appendable. |
| Methods inherited from class xtc.tree.Node |
|---|
add, add, addAll, addAll, addAll, addAll, addAllTo, addNode, contains, getBoolean, getBooleanProperty, getGeneric, getList, getLocation, getName, getNode, getProperty, getString, getStringProperty, getTokenText, hasLocation, hasName, hasProperty, hasTraversal, hasVariable, indexOf, isAnnotation, isGeneric, isList, isToken, iterator, lastIndexOf, properties, remove, removeProperty, set, setLocation, setLocation, setProperty, strip, toAnnotation, toList, toString, toToken |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public SequenceName name
public java.util.List<Element> elements
| Constructor Detail |
|---|
public Sequence()
public Sequence(int capacity)
capacity - The capacity.public Sequence(java.util.List<Element> elements)
elements - The list of elements.
public Sequence(SequenceName name,
java.util.List<Element> elements)
name - The name.elements - The list of elements.public Sequence(Element element)
element - The element.| Method Detail |
|---|
public Element.Tag tag()
Element
tag in class Elementpublic Sequence clear()
public Sequence add(Element e)
e - The element to add.
public Sequence addAll(java.util.List<Element> l)
l - The list of elements.
public boolean isEmpty()
isEmpty in class Nodetrue if this is an empty sequence.public int size()
size in class Nodepublic Element get(int idx)
get in class Nodeidx - The index.
java.lang.IndexOutOfBoundsException - Signals that the index is out of range.Token.test(Object),
Token.cast(Object),
GNode.test(Object),
GNode.cast(Object)public boolean hasTrailingChoice()
true if the last element is a choice.public Sequence subSequence(int start)
start - The inclusive start index.
java.lang.IndexOutOfBoundsException - Signals that the index is out of range.
public Sequence subSequence(int start,
int end)
start - The inclusive start index.end - The exclusive end index.
java.lang.IndexOutOfBoundsException - Signals that the index is out of range.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Object
public void write(java.lang.Appendable out)
throws java.io.IOException
NodeObject.toString().
write in class Nodeout - The appendable.
java.io.IOException - Signals an I/O error.public static Sequence ensure(Element e)
e - The element.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||