public abstract class AstNodeImpl<T extends AstNode<T>> extends AbstractList<T> implements AstNode<T>
modCountEMPTY_CHILD_NAMES, NT_CUSTOM_BIT, NT_NODE_LIST, NT_PARSER_ENTITY, NT_TEXT, NT_TUPLE_1, NT_TUPLE_2, NT_TUPLE_3, NT_TUPLE_4, NT_TUPLE_5, NT_UNTYPED| Modifier | Constructor and Description |
|---|---|
protected |
AstNodeImpl() |
protected |
AstNodeImpl(AstLocation location) |
protected |
AstNodeImpl(xtc.tree.Location location) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAll(xtc.util.Pair<? extends T> p)
Appends all items from the given list to list of children.
|
void |
clearAttributes()
Removes all attributes from this node.
|
Object |
clone() |
AstNodeImpl<T> |
cloneWrapException() |
AstNodeImpl<T> |
deepClone()
Unlike clone() deepClone() calls deepClone() on children and thus
recursively create a deep copy of a sub-tree.
|
AstNodeImpl<T> |
deepCloneWrapException() |
boolean |
equals(Object obj) |
static <S extends AstNode<S>> |
equalsNoTypeCheck(AstNode<S> a,
AstNode<S> b) |
T |
get(int index) |
<S extends T> |
get(int index,
Class<S> clazz)
Same as get(index) but casts the node to the specified type.
|
Object |
getAttribute(String name)
Retrieve the value of an attribute.
|
Map<String,Object> |
getAttributes()
Retrieve the attributes as an unmodifiable map.
|
boolean |
getBooleanAttribute(String name)
Retrieve the value of a boolean attribute.
|
String[] |
getChildNames()
Returns the names of the children.
|
int |
getIntAttribute(String name)
Retrieve the value of an integer attribute.
|
xtc.tree.Location |
getLocation() |
AstLocation |
getNativeLocation() |
String |
getNodeName()
Returns the name of this node.
|
int |
getNodeType()
Returns an integer value that identifies the node type.
|
String |
getNodeTypeName()
Returns the fully qualified name of this node's class.
|
Object |
getProperty(String name) |
Object |
getProperty(String name,
Object default_) |
int |
getPropertyCount() |
String |
getStringAttribute(String name)
Retrieve the value of a string attribute.
|
boolean |
hasAttribute(String name)
Check whether a certain attribute is attached to this node.
|
boolean |
hasAttributes()
Tell whether this node has any attributes attached.
|
boolean |
hasLocation() |
boolean |
hasProperties() |
boolean |
hasProperty(String name) |
boolean |
isList()
Determine whether this node can have a variable number of children and
implements the
List interface (or parts of it). |
boolean |
isNodeType(int testType)
Returns
true if the given node type equals the node type
returned by getNodeType(). |
AstNodePropertyIterator |
propertyIterator()
Return an iterator which iterates over this node's properties.
|
Object |
removeAttribute(String name)
Remove an attribute from this node.
|
Object |
setAttribute(String name,
Object value)
Assign an attribute to this node.
|
void |
setAttributes(Map<String,Object> attrs)
Set the attributes for this node.
|
boolean |
setBooleanAttribute(String name,
boolean value)
Assign a boolean attribute to this node.
|
Integer |
setIntAttribute(String name,
Integer value)
Assign an integer attribute to this node.
|
void |
setLocation(xtc.tree.Locatable locatable) |
void |
setLocation(xtc.tree.Location location) |
void |
setNativeLocation(AstLocation location) |
Object |
setProperty(String name,
Object value) |
String |
setStringAttribute(String name,
String value)
Assign an string attribute to this node.
|
int |
size() |
String |
toString() |
void |
toString(Appendable out) |
add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayfinalize, getClass, notify, notifyAll, wait, wait, waitadd, add, addAll, addAll, clear, contains, containsAll, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArrayparallelStream, removeIf, streamprotected AstNodeImpl()
protected AstNodeImpl(AstLocation location)
protected AstNodeImpl(xtc.tree.Location location)
public int getNodeType()
getNodeType in interface AstNode<T extends AstNode<T>>public boolean isNodeType(int testType)
true if the given node type equals the node type
returned by getNodeType().isNodeType in interface AstNode<T extends AstNode<T>>public final String getNodeTypeName()
getNodeTypeName in interface AstNode<T extends AstNode<T>>public String getNodeName()
getNodeName in interface AstNode<T extends AstNode<T>>public final boolean hasAttributes()
AstNodeAttributeInterfacehasAttributes in interface AstNodeAttributeInterfaceTrue if this node has any attributes attached,
otherwise false.public final Map<String,Object> getAttributes()
AstNodeAttributeInterfacegetAttributes in interface AstNodeAttributeInterfacepublic void setAttributes(Map<String,Object> attrs)
AstNodeAttributeInterfacesetAttributes in interface AstNodeAttributeInterfaceattrs - The attributes to attach to this node.public void clearAttributes()
AstNodeAttributeInterfaceclearAttributes in interface AstNodeAttributeInterfacepublic final boolean hasAttribute(String name)
AstNodeAttributeInterfacehasAttribute in interface AstNodeAttributeInterfacename - The name of the attribute to test.True if an attribute with the respective name is
attached to this node, false otherwise.public final Object getAttribute(String name)
AstNodeAttributeInterfacegetAttribute in interface AstNodeAttributeInterfacename - The name of the attribute to retrieve.null if the
attribute does not exist.public Object setAttribute(String name, Object value)
AstNodeAttributeInterfacesetAttribute in interface AstNodeAttributeInterfacename - The name of the attribute.value - The value associated with the attribute.public Object removeAttribute(String name)
AstNodeAttributeInterfaceremoveAttribute in interface AstNodeAttributeInterfacename - The name of the attribute to remove.public final int getIntAttribute(String name)
AstNodeAttributeInterfacegetIntAttribute in interface AstNodeAttributeInterfacename - The name of the integer attribute to retrieve.0
if the attribute does not exist.public Integer setIntAttribute(String name, Integer value)
AstNodeAttributeInterfacesetIntAttribute in interface AstNodeAttributeInterfacename - The name of the attribute.value - The integer value associated with the attribute.public final boolean getBooleanAttribute(String name)
AstNodeAttributeInterfacegetBooleanAttribute in interface AstNodeAttributeInterfacename - The name of the boolean attribute to retrieve.false if the attribute does not exist.public boolean setBooleanAttribute(String name, boolean value)
AstNodeAttributeInterfacesetBooleanAttribute in interface AstNodeAttributeInterfacename - The name of the attribute.value - The boolean value associated with the attribute.null if the attribute does not exist yet.public final String getStringAttribute(String name)
AstNodeAttributeInterfacegetStringAttribute in interface AstNodeAttributeInterfacename - The name of the string attribute to retrieve.null
if the attribute does not exist.public String setStringAttribute(String name, String value)
AstNodeAttributeInterfacesetStringAttribute in interface AstNodeAttributeInterfacename - The name of the attribute.value - The String value associated with the attribute.public final boolean hasProperties()
hasProperties in interface AstNodePropertyInterfacepublic int getPropertyCount()
getPropertyCount in interface AstNodePropertyInterfacepublic Object getProperty(String name)
getProperty in interface AstNodePropertyInterfacepublic Object getProperty(String name, Object default_)
getProperty in interface AstNodePropertyInterfacepublic boolean hasProperty(String name)
hasProperty in interface AstNodePropertyInterfacepublic Object setProperty(String name, Object value)
setProperty in interface AstNodePropertyInterfacepublic AstNodePropertyIterator propertyIterator()
AstNodePropertyInterfacepropertyIterator in interface AstNodePropertyInterfacepublic final boolean hasLocation()
hasLocation in interface xtc.tree.Locatablepublic final xtc.tree.Location getLocation()
getLocation in interface xtc.tree.Locatablepublic void setLocation(xtc.tree.Location location)
setLocation in interface xtc.tree.Locatablepublic void setLocation(xtc.tree.Locatable locatable)
setLocation in interface xtc.tree.Locatablepublic final AstLocation getNativeLocation()
getNativeLocation in interface AstNode<T extends AstNode<T>>public void setNativeLocation(AstLocation location)
setNativeLocation in interface AstNode<T extends AstNode<T>>public int size()
public T get(int index)
public <S extends T> S get(int index, Class<S> clazz)
AstNodepublic boolean addAll(xtc.util.Pair<? extends T> p)
public boolean isList()
List interface (or parts of it).public String[] getChildNames()
getChildNames in interface AstNode<T extends AstNode<T>>public void toString(Appendable out) throws IOException
public String toString()
toString in class AbstractCollection<T extends AstNode<T>>public Object clone() throws CloneNotSupportedException
public AstNodeImpl<T> cloneWrapException()
cloneWrapException in interface AstNode<T extends AstNode<T>>public AstNodeImpl<T> deepClone() throws CloneNotSupportedException
public AstNodeImpl<T> deepCloneWrapException()
deepCloneWrapException in interface AstNode<T extends AstNode<T>>public boolean equals(Object obj)
Copyright © 2009–2017 University of Erlangen-Nürnberg - Open Source Research Group. All rights reserved.