public abstract class Operator extends JavaNonTerminalProgramElement implements Expression, ExpressionContainer
Modifier and Type | Field and Description |
---|---|
protected ImmutableArray<Expression> |
children
Children.
|
static int |
INFIX |
static int |
POSTFIX |
static int |
PREFIX
Relative positioning of the operator.
|
Constructor and Description |
---|
Operator() |
Operator(Expression unaryChild)
Operator.
|
Operator(Expression[] arguments)
Operator.
|
Operator(Expression lhs,
Expression rhs)
Operator.
|
Operator(ExtList children)
Constructor for the transformation of COMPOST ASTs to KeY.
|
Modifier and Type | Method and Description |
---|---|
ImmutableArray<Expression> |
getArguments()
return arguments
|
abstract int |
getArity()
getArity() == getASTchildren().size()
|
ProgramElement |
getChildAt(int index)
Returns the child at the specified index in this node's "virtual"
child array
|
int |
getChildCount()
Returns the number of children of this node.
|
Expression |
getExpressionAt(int index) |
int |
getExpressionCount()
Get the number of expressions in this container.
|
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source.
|
SourceElement |
getFirstElementIncludingBlocks()
Finds the source element that occurs first in the source.
|
abstract KeYJavaType |
getKeYJavaType(Services javaServ,
ExecutionContext ec)
returns the
KeYJavaType of an expression |
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
abstract int |
getNotation() |
abstract int |
getPrecedence()
0 is the "highest" precedence (obtained by parantheses),
13 the "lowest".
|
boolean |
isLeftAssociative()
Checks if this operator is left or right associative.
|
boolean |
isToBeParenthesized() |
static boolean |
precedes(Operator a,
Operator b) |
java.lang.String |
reuseSignature(Services services,
ExecutionContext ec)
overriden from JavaProgramElement.
|
compatibleBlockSize, computeHashCode, equals, equalsModRenaming, getArrayPos, match, matchChildren
getComments, hashCode, prettyPrint, prettyPrintMain
getEndPosition, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments, match
equalsModRenaming, getEndPosition, getPositionInfo, getRelativePosition, getStartPosition, prettyPrint, visit
protected final ImmutableArray<Expression> children
public static final int PREFIX
public static final int INFIX
public static final int POSTFIX
public Operator()
public Operator(Expression lhs, Expression rhs)
lhs
- an expression.rhs
- an expression.public Operator(ExtList children)
children
- the children of this AST element as KeY classes.
In this case the order of the children is IMPORTANT.
May contain:
2 of Expression (the first Expression as left hand
side, the second as right hand side),
Commentspublic Operator(Expression unaryChild)
unaryChild
- an expression.public Operator(Expression[] arguments)
arguments
- an array of expression.public abstract int getArity()
public abstract int getPrecedence()
public static boolean precedes(Operator a, Operator b)
public abstract int getNotation()
public boolean isLeftAssociative()
true
, if the operator is left associative,
false
otherwise.public SourceElement getFirstElement()
JavaSourceElement
getFirstElement
in interface SourceElement
getFirstElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getStartPosition()
public SourceElement getFirstElementIncludingBlocks()
SourceElement
getFirstElementIncludingBlocks
in interface SourceElement
getFirstElementIncludingBlocks
in class JavaSourceElement
SourceElement.getStartPosition()
public SourceElement getLastElement()
JavaSourceElement
getLastElement
in interface SourceElement
getLastElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getEndPosition()
public int getChildCount()
getChildCount
in interface NonTerminalProgramElement
public ProgramElement getChildAt(int index)
getChildAt
in interface NonTerminalProgramElement
index
- an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException
- if index is out
of boundspublic int getExpressionCount()
getExpressionCount
in interface ExpressionContainer
public Expression getExpressionAt(int index)
getExpressionAt
in interface ExpressionContainer
public ImmutableArray<Expression> getArguments()
public boolean isToBeParenthesized()
public java.lang.String reuseSignature(Services services, ExecutionContext ec)
reuseSignature
in class JavaProgramElement
ec
- TODOpublic abstract KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec)
Expression
KeYJavaType
of an expressiongetKeYJavaType
in interface Expression