public class WhileStm extends Compound
This AST element represents a while loop statement.
A while loop is a pre-tested loop, that consists of a test predicate and a body.
while(predicate) body
DoWhileStm
,
ForStm
Modifier and Type | Method and Description |
---|---|
static WhileStm |
build(Predicate p,
Block b)
Create a while loop.
|
Block |
getBody()
Get the loop body.
|
Predicate |
getPredicate()
Get the loop predicate.
|
void |
setBody(Block b)
Set the body.
|
void |
setPredicate(Predicate p)
Set the predicate.
|
attachTag, getSubElements, isCompound, replaceSubElement, retrieveTag
public static WhileStm build(Predicate p, Block b)
Create a while loop.
p
- mandatory predicateb
- mandatory bodypublic Predicate getPredicate()
Get the loop predicate.
public Block getBody()
Get the loop body.
public void setPredicate(Predicate p)
Set the predicate. Convenience routine.
p
- mandatory predicatepublic void setBody(Block b)
Set the body. Convenience routine.
b
- mandatory body