Class WhileStatement
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.templateModel.AbstractTemplateElement
-
- net.ssehub.easy.instantiation.core.model.templateModel.WhileStatement
-
- All Implemented Interfaces:
ILanguageElement,ITemplateElement,ITemplateLangElement
public class WhileStatement extends AbstractTemplateElement
Representation of a loop-statement in VIL which allows multiple processing of aWorkflowElementBlockinstance.- Author:
- kroeher
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionconditionprivate ITemplateElementstatement
-
Constructor Summary
Constructors Constructor Description WhileStatement(Expression condition, ITemplateElement statement)Create a loop-statement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IVisitor visitor)Accepts the visitor for visiting.booleanendsWithContentStatement()Returns whether this element ends with a content statement.ExpressiongetConditionExpression()Get the condition of this loop.ITemplateElementgetLoopStatement()Get the loop-statement which may subsume a set of template elements that will be processed multiple times.TypeDescriptor<?>inferType()Infers the type of this language element.booleanisBlock()Returns whether this element is a block (opposite is a single statement).-
Methods inherited from class net.ssehub.easy.instantiation.core.model.templateModel.AbstractTemplateElement
getParent, setParent
-
-
-
-
Field Detail
-
condition
private Expression condition
-
statement
private ITemplateElement statement
-
-
Constructor Detail
-
WhileStatement
public WhileStatement(Expression condition, ITemplateElement statement) throws VilException
Create a loop-statement.- Parameters:
condition- the condition determining the end of the loop (Boolean expression)statement- the loop-statement which may subsumes a set of template elements that will be processed multiple times.- Throws:
VilException- in case of semantic problems while creating this loop object
-
-
Method Detail
-
getConditionExpression
public Expression getConditionExpression()
Get the condition of this loop.- Returns:
- The
conditionof this loop.
-
getLoopStatement
public ITemplateElement getLoopStatement()
Get the loop-statement which may subsume a set of template elements that will be processed multiple times.- Returns:
- The template element that represents the loop-statement/block.
-
accept
public java.lang.Object accept(IVisitor visitor) throws VilException
Description copied from interface:ITemplateLangElementAccepts the visitor for visiting.- Parameters:
visitor- the visitor to be used- Returns:
- the result of visiting this instance (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
isBlock
public boolean isBlock()
Description copied from interface:ITemplateElementReturns whether this element is a block (opposite is a single statement).- Returns:
trueif it is a block,falseelse
-
inferType
public TypeDescriptor<?> inferType() throws VilException
Description copied from interface:ITemplateElementInfers the type of this language element.- Returns:
- the type of this language element
- Throws:
VilException- in case that type errors occur
-
endsWithContentStatement
public boolean endsWithContentStatement()
Description copied from interface:ITemplateElementReturns whether this element ends with a content statement.- Returns:
truefor end with content statement,falseelse
-
-