org.grinvin.expr

Class Compound

Implemented Interfaces:
Expression

public class Compound
extends java.lang.Object
implements Expression

Compound expression, i.e., an expression containing one or several 'sub-expressions'.

Constructor Summary

Compound(Operator operator, Expression arg)
Create an expression which applies the given operator to the given argument.
Compound(Operator operator, Expression arg1, Expression arg2)
Create an expression which applies the given operator to the two given arguments.
Compound(Operator operator, Expression[] children)
Create an expression which applies the given operator to the given array of arguments.

Method Summary

void
accept(Expression.Visitor visitor)
Accept a visitor on this node.
Expression
getChild(int index)
Return the child with the given index.
int
getNumberOfChildren()
The number of argument children for this compound expression.
Operator
getOperator()
Get the operator for this expression.

Constructor Details

Compound

public Compound(Operator operator,
                Expression arg)
Create an expression which applies the given operator to the given argument.

Compound

public Compound(Operator operator,
                Expression arg1,
                Expression arg2)
Create an expression which applies the given operator to the two given arguments.

Compound

public Compound(Operator operator,
                Expression[] children)
Create an expression which applies the given operator to the given array of arguments.

Method Details

accept

public void accept(Expression.Visitor visitor)
Accept a visitor on this node.
Specified by:
accept in interface Expression

getChild

public Expression getChild(int index)
Return the child with the given index.

getNumberOfChildren

public int getNumberOfChildren()
The number of argument children for this compound expression.

getOperator

public Operator getOperator()
Get the operator for this expression.