public interface Traversable extends Printable
| Modifier and Type | Method and Description |
|---|---|
java.util.List<Traversable> |
getChildren()
Provides access to the children of this object as a list.
|
Traversable |
getParent()
Provides access to the parent of this object.
|
void |
removeChild(Traversable child)
Removes the specified child.
|
void |
setChild(int index,
Traversable t)
Sets the indexth child of this object to t.
|
void |
setParent(Traversable t)
Sets the parent of this object.
|
java.util.List<Traversable> getChildren()
Traversable getParent()
void removeChild(Traversable child)
child - a reference to a child object that must match with ==.NotAChildException - if the child does not exist.java.lang.UnsupportedOperationException - if the child exists but the
parent refuses to let it go. For instance, a BinaryExpression
may refuse to remove its left side expression because that
would lead to invalid IR. The only way to change a child of such
an expression is to replace it.void setChild(int index,
Traversable t)
NotAnOrphanException - if t already has a parent.java.lang.IllegalArgumentException - if the type of the new child would
violate a class invariant by becoming the indexth
child.void setParent(Traversable t)
NotAChildException - if the parent does not already consider
this object a child.java.lang.IllegalArgumentException - (possibly) if the type of the parent
would violate a class invariant. Not all classes perform this check
because, for example, Expressions can appear as children of so many
things that it is simply not worth checking.