public final class BinaryOperation extends ExpressionStatement<BinaryOperation>
OperatorType
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.
|
static BinaryOperation |
create(java.lang.Object type,
java.lang.Object left,
java.lang.Object right)
Full generic binary operation creation in one call.
|
OperatorType |
getType() |
boolean |
isMethodCall() |
ExpressionStatement<?> |
left() |
BinaryOperation |
left(java.lang.Object expr)
Define the left expression of this operation.
|
static BinaryOperation |
of(java.lang.Object type)
Create a binary operation.
|
protected void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
ExpressionStatement<?> |
right() |
BinaryOperation |
right(java.lang.Object expr)
Define the right expression of this operation.
|
protected BinaryOperation |
self() |
java.lang.String |
toString() |
call, clearDeclarations, declarations, hasLocalDeclarations, with
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 BinaryOperation of(java.lang.Object type)
type
- a OperatorType
or a String
representing the operator.public static BinaryOperation create(java.lang.Object type, java.lang.Object left, java.lang.Object right)
Less readable than the fluent API, but useful when doing meta-generation
type
- the type of the operation (of(Object)
)left
- the left expression.right
- the right expression.protected BinaryOperation self()
self
in class GoloElement<BinaryOperation>
public OperatorType getType()
public ExpressionStatement<?> left()
public BinaryOperation left(java.lang.Object expr)
This is a builder method.
expr
- the ExpressionStatement
to use as the left
operandpublic BinaryOperation right(java.lang.Object expr)
This is a builder method.
expr
- the ExpressionStatement
to use as the
right operandpublic ExpressionStatement<?> right()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isMethodCall()
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<BinaryOperation>
public java.util.List<GoloElement<?>> children()
children
in class GoloElement<BinaryOperation>
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<BinaryOperation>
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)