public final class ForEachLoopStatement extends GoloStatement<ForEachLoopStatement> implements BlockContainer<ForEachLoopStatement>, ReferencesHolder
foreach loop on an iterator.
 For instance:
 foreach x in range(5) {
   println(x)
 }
 | Modifier and Type | Method and Description | 
|---|---|
void | 
accept(GoloIrVisitor visitor)
Accept the visitor. 
 | 
ForEachLoopStatement | 
block(java.lang.Object block)
Defines the contained block. 
 | 
java.util.List<GoloElement<?>> | 
children()
Returns a list of all the direct children of this node. 
 | 
static ForEachLoopStatement | 
create()  | 
static ForEachLoopStatement | 
create(boolean varargs,
      java.lang.Object iterable,
      java.lang.Object when,
      java.lang.Object block,
      java.lang.Object... vars)
Complete foreach loop. 
 | 
Block | 
getBlock()  | 
ExpressionStatement<?> | 
getIterable()  | 
LocalReference | 
getLocalReference()  | 
LocalReference[] | 
getReferences()
Returns the references contained in this element. 
 | 
int | 
getReferencesCount()
Returns the number of references contained in this element. 
 | 
ExpressionStatement<?> | 
getWhenClause()  | 
boolean | 
hasWhenClause()  | 
ForEachLoopStatement | 
in(java.lang.Object iterable)
Defines the iterable on which to loop. 
 | 
boolean | 
isDestructuring()  | 
boolean | 
isVarargs()  | 
protected void | 
replaceElement(GoloElement<?> original,
              GoloElement<?> newElement)
Replace a child. 
 | 
protected ForEachLoopStatement | 
self()  | 
ForEachLoopStatement | 
var(java.lang.Object varRef)
Adds a loop variable. 
 | 
ForEachLoopStatement | 
varargs(boolean b)  | 
ForEachLoopStatement | 
when(java.lang.Object clause)
Adds a when clause to the loop. 
 | 
ofancestor, ancestor, ancestorOfType, cantConvert, cantReplace, cantReplace, children, children, descendants, descendants, descendants, documentation, documentation, doesNotContain, enclosingModule, getLocalReferenceTable, hasParent, hasPosition, inheritedMetadata, makeParentOf, metadata, metadata, next, next, next, ofAST, parent, positionInSourceCode, positionInSourceCode, previous, previous, previous, replaceInParentBy, walkclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbodygetDeclaringReferencespublic static ForEachLoopStatement create(boolean varargs, java.lang.Object iterable, java.lang.Object when, java.lang.Object block, java.lang.Object... vars)
varargs - the parameters of the loop are variable length destructuringiterable - the iterable we loop onwhen - the loop filterblock - the loop blockvars - the loop variablespublic static ForEachLoopStatement create()
public ForEachLoopStatement block(java.lang.Object block)
This is a builder method.
block in interface BlockContainer<ForEachLoopStatement>block - an object that can be converted into a BlockBlock.of(Object)protected ForEachLoopStatement self()
self in class GoloElement<ForEachLoopStatement>public ForEachLoopStatement in(java.lang.Object iterable)
This is a builder method.
iterable - an ExpressionStatement representing an Iterable expression.public ForEachLoopStatement varargs(boolean b)
public ForEachLoopStatement var(java.lang.Object varRef)
This is a builder method.
varRef - the variable (a LocalReference create)LocalReference.of(Object)public ForEachLoopStatement when(java.lang.Object clause)
This is a builder method.
clause - an ExpressionStatement used as a condition.public ExpressionStatement<?> getIterable()
public Block getBlock()
getBlock in interface BlockContainer<ForEachLoopStatement>public boolean isDestructuring()
public boolean isVarargs()
public LocalReference getLocalReference()
public LocalReference[] getReferences()
getReferences in interface ReferencesHolderpublic int getReferencesCount()
getReferencesCount in interface ReferencesHolderpublic boolean hasWhenClause()
public ExpressionStatement<?> getWhenClause()
public void accept(GoloIrVisitor visitor)
 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<ForEachLoopStatement>public java.util.List<GoloElement<?>> children()
children in class GoloElement<ForEachLoopStatement>protected void replaceElement(GoloElement<?> original, GoloElement<?> newElement)
 Replace original with newElement if original is a child of this node
 and type matches.
replaceElement in class GoloElement<ForEachLoopStatement>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)