public final class MatchExpression extends ExpressionStatement<MatchExpression> implements Alternatives<ExpressionStatement<?>>
match node.
 This node describe tree such as:
  match {
    when condition_1 then expression_1
    when condition_2 then expression_2
    otherwise default_expression
  }
 | Modifier and Type | Method and Description | 
|---|---|
void | 
accept(GoloIrVisitor visitor)
Accept the visitor. 
 | 
java.util.List<GoloElement<?>> | 
children()
Returns a list of all the direct children of this node. 
 | 
java.util.List<WhenClause<ExpressionStatement<?>>> | 
getClauses()  | 
ExpressionStatement<?> | 
getOtherwise()  | 
static MatchExpression | 
match()
Creates an empty match expression. 
 | 
MatchExpression | 
otherwise(java.lang.Object action)
Defines the default alternative clause. 
 | 
protected void | 
replaceElement(GoloElement<?> original,
              GoloElement<?> newElement)
Replace a child. 
 | 
protected MatchExpression | 
self()  | 
MatchExpression | 
then(java.lang.Object action)
Defines the action of the previous clause. 
 | 
MatchExpression | 
when(java.lang.Object cond)
Defines a new alternative clause. 
 | 
call, clearDeclarations, declarations, hasLocalDeclarations, of, withancestor, 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, walkpublic static MatchExpression match()
protected MatchExpression self()
self in class GoloElement<MatchExpression>public MatchExpression when(java.lang.Object cond)
This is a builder method.
when in interface Alternatives<ExpressionStatement<?>>cond - an expression node defining the clause.public MatchExpression then(java.lang.Object action)
This is a builder method.
It must be called after a call to when. For instance
 
  alternative.when(condition).then(action);
 then in interface Alternatives<ExpressionStatement<?>>action - a ExpressionStatement containing the expression to return.public MatchExpression otherwise(java.lang.Object action)
This is a builder method.
otherwise in interface Alternatives<ExpressionStatement<?>>action - a ExpressionStatement containing the expression to return.public java.util.List<WhenClause<ExpressionStatement<?>>> getClauses()
getClauses in interface Alternatives<ExpressionStatement<?>>public ExpressionStatement<?> getOtherwise()
getOtherwise in interface Alternatives<ExpressionStatement<?>>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<MatchExpression>public java.util.List<GoloElement<?>> children()
children in class GoloElement<MatchExpression>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<MatchExpression>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)