public class If extends BranchStatement implements ExpressionContainer
Modifier and Type | Field and Description |
---|---|
protected Else |
elseBranch
Else branch.
|
protected Expression |
expression
Expression.
|
protected Then |
thenBranch
Then branch.
|
Constructor and Description |
---|
If(Expression e,
Then thenBranch)
If.
|
If(Expression e,
Then thenBranch,
Else elseBranch)
If.
|
If(ExtList children)
Constructor for the transformation of COMPOST ASTs to KeY.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkValidity()
throws an exception if the if-statement guard or then-branch are null
|
Branch |
getBranchAt(int index) |
int |
getBranchCount()
Get the number of branches in this container.
|
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.
|
Else |
getElse()
Get else.
|
Expression |
getExpression()
Get expression.
|
Expression |
getExpressionAt(int index) |
int |
getExpressionCount()
Get the number of expressions in this container.
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
Then |
getThen()
Get then.
|
void |
prettyPrint(PrettyPrinter p)
Pretty printing the source element.
|
void |
visit(Visitor v)
calls the corresponding method of a visitor in order to
perform some action/transformation on this element
|
compatibleBlockSize, computeHashCode, equals, equalsModRenaming, getArrayPos, match, matchChildren
getComments, hashCode, prettyPrintMain, reuseSignature
getEndPosition, getFirstElement, getFirstElementIncludingBlocks, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments, match
equalsModRenaming, getEndPosition, getFirstElement, getFirstElementIncludingBlocks, getPositionInfo, getRelativePosition, getStartPosition
protected Then thenBranch
protected Else elseBranch
protected Expression expression
public If(ExtList children)
children
- the children of this AST element as KeY classes.
May contain: Comments, a Then, an Else, an Expression (as condition of If)public If(Expression e, Then thenBranch)
e
- an expression.thenBranch
- a then.public If(Expression e, Then thenBranch, Else elseBranch)
e
- an expression.thenBranch
- a then.elseBranch
- an else.private void checkValidity()
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 Expression getExpression()
public Then getThen()
public Else getElse()
public int getBranchCount()
getBranchCount
in class BranchStatement
public Branch getBranchAt(int index)
getBranchAt
in class BranchStatement
public void visit(Visitor v)
visit
in interface SourceElement
v
- the Visitorpublic void prettyPrint(PrettyPrinter p) throws java.io.IOException
JavaSourceElement
prettyPrint
in interface SourceElement
prettyPrint
in class JavaProgramElement
p
- a pretty printer.java.io.IOException
- occasionally thrown.