public class Sequence extends Element
Element.Tag| Modifier and Type | Field and Description |
|---|---|
java.util.List<Element> |
elements
The ordered list of grammar elements.
|
SequenceName |
name
The optional name.
|
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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, toTokenpublic SequenceName name
public java.util.List<Element> elements
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.public Element.Tag tag()
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()
public int size()
public 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.Objectpublic void write(java.lang.Appendable out)
throws java.io.IOException
NodeObject.toString().public static Sequence ensure(Element e)
e - The element.Copyright © 2014. All Rights Reserved.