de.upb.hni.vmagic.statement
Class ExitStatement

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.ExitStatement

public class ExitStatement
extends SequentialStatement

Exit statement.

Example:
vMAGIC code:
ForStatement loop = new ForStatement("I",
    new Range(0, Range.Direction.TO, 127));
loop.setLabel("I_LOOP");

loop.getStatements().add(new ExitStatement(loop,
    new Equals(loop.getParameter(), new DecimalLiteral(100))));
VHDL output:
I_LOOP : for I in 0 to 127 loop
    exit I_LOOP when I = 100;
end loop;

Constructor Summary
ExitStatement()
          Creates an exit statement,
ExitStatement(Expression condition)
          Creates an exit statement with the given condition.
ExitStatement(LoopStatement loop)
          Creates an exit statement for the given loop.
ExitStatement(LoopStatement loop, Expression condition)
          Creates an exit statement for the given loop with a condition.
 
Method Summary
 Expression getCondition()
          Returns the condition for this exit statement.
 LoopStatement getLoop()
          Returns the associated loop statement.
 void setCondition(Expression condition)
          Sets the condition for this exit statement.
 void setLoop(LoopStatement loop)
          Sets the associated loop statement.
 
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

ExitStatement

public ExitStatement()
Creates an exit statement,


ExitStatement

public ExitStatement(LoopStatement loop)
Creates an exit statement for the given loop.

Parameters:
loop - the loop

ExitStatement

public ExitStatement(Expression condition)
Creates an exit statement with the given condition.

Parameters:
condition - the condition

ExitStatement

public ExitStatement(LoopStatement loop,
                     Expression condition)
Creates an exit statement for the given loop with a condition.

Parameters:
loop - the loop
condition - the condition
Method Detail

getCondition

public Expression getCondition()
Returns the condition for this exit statement.

Returns:
the condition

setCondition

public void setCondition(Expression condition)
Sets the condition for this exit statement.

Parameters:
condition - the condition

getLoop

public LoopStatement getLoop()
Returns the associated loop statement.

Returns:
the loop statement or null if no loop is set

setLoop

public void setLoop(LoopStatement loop)
Sets the associated loop statement.

Parameters:
loop - the loop statement or null to remove loop