public final class ToplevelElements extends GoloElement<ToplevelElements> implements java.lang.Iterable<GoloElement<?>>
GoloElement
.
This element must never be present in a tree.
Modifier and Type | Method and Description |
---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
ToplevelElements |
add(java.lang.Object element) |
java.util.List<GoloElement<?>> |
children()
Returns a list of all the direct children of this node.
|
boolean |
isEmpty() |
java.util.Iterator<GoloElement<?>> |
iterator() |
ToplevelElements |
map(FunctionReference fun)
Map a golo function on the contained elements.
|
static ToplevelElements |
of(java.lang.Object... elements)
Creates a top-level elements container.
|
void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
protected ToplevelElements |
self() |
ancestor, ancestor, ancestorOfType, cantConvert, cantReplace, cantReplace, children, children, descendants, descendants, descendants, documentation, documentation, doesNotContain, enclosingModule, getLocalReferenceTable, hasParent, hasPosition, makeParentOf, metadata, metadata, next, next, next, ofAST, parent, positionInSourceCode, positionInSourceCode, previous, previous, previous, replaceInParentBy, walk
public static ToplevelElements of(java.lang.Object... elements)
protected ToplevelElements self()
self
in class GoloElement<ToplevelElements>
public ToplevelElements add(java.lang.Object element)
public boolean isEmpty()
public ToplevelElements map(FunctionReference fun) throws java.lang.Throwable
java.lang.Throwable
public java.util.Iterator<GoloElement<?>> iterator()
iterator
in interface java.lang.Iterable<GoloElement<?>>
public java.util.List<GoloElement<?>> children()
GoloElement
children
in class GoloElement<ToplevelElements>
public void replaceElement(GoloElement<?> original, GoloElement<?> newElement)
GoloElement
Replace original
with newElement
if original
is a child of this node
and type matches.
replaceElement
in class GoloElement<ToplevelElements>
original
- the original value to replace. Must be a child of this nodenewElement
- the element to replace with. Type must match.GoloElement.cantReplace()
,
GoloElement.cantReplace(GoloElement, GoloElement)
,
GoloElement.doesNotContain(GoloElement)
,
GoloElement.cantConvert(String, Object)
public void accept(GoloIrVisitor visitor)
GoloElement
This method should only call the visitor visitXXXX
method.
The children of this node will be visited by the
GoloElement.walk(GoloIrVisitor)
method.
accept
in class GoloElement<ToplevelElements>