de.upb.hni.vmagic.statement
Class IfStatement

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

public class IfStatement
extends SequentialStatement

If statement.

Example:
vMAGIC code:
IfStatement statement = new IfStatement(Standard.BOOLEAN_FALSE);
statement.getStatements().add(new ReportStatement("if part"));
statement.createElsifPart(Standard.BOOLEAN_TRUE).
    getStatements().add(new ReportStatement("elsif part"));
statement.getElseStatements().add(new ReportStatement("else part"));
VHDL output:
if FALSE then
    report "if part";
elsif TRUE then
    report "elsif part";
else
    report "else part";
end if;

Nested Class Summary
 class IfStatement.ElsifPart
          Elsif part in an if statement.
 
Constructor Summary
IfStatement(Expression condition)
          Creates an if statement.
 
Method Summary
 IfStatement.ElsifPart createElsifPart(Expression condition)
          Creates a elsif part and adds it to this if statement.
 Expression getCondition()
          Returns the if condition.
 java.util.List<SequentialStatement> getElseStatements()
          Returns the statement in the else part of the if statement.
 java.util.List<IfStatement.ElsifPart> getElsifParts()
          Returns the elsif parts.
 java.util.List<SequentialStatement> getStatements()
          Returns the statement.
 void setCondition(Expression condition)
          Returns the if condition.
 
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

IfStatement

public IfStatement(Expression condition)
Creates an if statement.

Parameters:
condition - the if condition
Method Detail

getCondition

public Expression getCondition()
Returns the if condition.

Returns:
the condition

setCondition

public void setCondition(Expression condition)
Returns the if condition.

Parameters:
condition - the condition

getStatements

public java.util.List<SequentialStatement> getStatements()
Returns the statement.

Returns:
a modifiable list of sequential statements

getElseStatements

public java.util.List<SequentialStatement> getElseStatements()
Returns the statement in the else part of the if statement. If the list is empty no else part will be created.

Returns:
a modifiable list of sequential statements

createElsifPart

public IfStatement.ElsifPart createElsifPart(Expression condition)
Creates a elsif part and adds it to this if statement.

Parameters:
condition - the condition for the elsif part
Returns:
the creates elsif part

getElsifParts

public java.util.List<IfStatement.ElsifPart> getElsifParts()
Returns the elsif parts.

Returns:
a modifiable list of elsif parts