de.upb.hni.vmagic.statement
Class WhileStatement

java.lang.Object
  extended by de.upb.hni.vmagic.VhdlElement
      extended by de.upb.hni.vmagic.LabeledElement
          extended by de.upb.hni.vmagic.statement.SequentialStatement
              extended by de.upb.hni.vmagic.statement.LoopStatement
                  extended by de.upb.hni.vmagic.statement.WhileStatement
All Implemented Interfaces:
DeclarativeRegion

public class WhileStatement
extends LoopStatement

While loop.

Example:
vMAGIC code:
Variable i = new Variable("i", Standard.INTEGER, new DecimalLiteral(0));
Expression condition = new LessThan(i, new DecimalLiteral(100));
WhileStatement loop = new WhileStatement(condition);
loop.getStatements().add(new ReportStatement("loop"));
Expression addExpression = new Add(i, new DecimalLiteral(1));
loop.getStatements().add(new VariableAssignment(i, addExpression));
VHDL output:
while i < 100 loop
        report "loop";
    i := i + 1;
end loop;

Constructor Summary
WhileStatement(Expression condition)
          Creates a while loop.
 
Method Summary
 Expression getCondition()
          Returns the condition.
 void setCondition(Expression condition)
          Sets the condition.
 
Methods inherited from class de.upb.hni.vmagic.statement.LoopStatement
getScope, getStatements
 
Methods inherited from class de.upb.hni.vmagic.statement.SequentialStatement
getLabel, setLabel
 
Methods inherited from class de.upb.hni.vmagic.VhdlElement
getParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WhileStatement

public WhileStatement(Expression condition)
Creates a while loop.

Parameters:
condition - the while condition
Method Detail

getCondition

public Expression getCondition()
Returns the condition.

Returns:
the condition

setCondition

public void setCondition(Expression condition)
Sets the condition.

Parameters:
condition - the condition