org.shiwa.fgi.iwir
Class ConditionExpression

java.lang.Object
  extended by org.shiwa.fgi.iwir.ConditionExpression

public class ConditionExpression
extends java.lang.Object

The Class ConditionExpression represents a condition. Contains the string and the node representation. A ConditionExpression can either be parsed from a condition string e.g. new ConditionExpression(in = 2); or build using methods provided by the Utility class ConditionAST e.g. ConditionNode n = ConditionAST.createEqOp(ConditionAST.createPortNode("in"), ConditionAST.createIntNode(3)); new ConditionExpression(n); Conditions can be evaluated setting the values directly for the input ports using the setValue() methods. The evaluation can then be invoked using either the ConditionAST class or by the eval() methods of this class. For additional information see ConditionNode and ConditionAST .


Constructor Summary
ConditionExpression(ConditionNode node)
          Instantiates a new condition expression.
ConditionExpression(java.lang.String condition)
          Instantiates a new condition expression.
 
Method Summary
 boolean eval()
          Evaluates the condition of a task, if the values are set using the setValue() operations.
 ConditionNode getConditionAsNode()
          Gets the condition as ConditionNode representation.
 java.lang.String getConditionAsString()
          Gets the condition as string representation.
 java.lang.String toString()
          Gets the condition as string representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConditionExpression

public ConditionExpression(java.lang.String condition)
                    throws ConditionParseException
Instantiates a new condition expression. A ConditionParseException is thrown if the condition could not be parsed.

Parameters:
condition - the condition
Throws:
ConditionParseException

ConditionExpression

public ConditionExpression(ConditionNode node)
Instantiates a new condition expression.

Parameters:
node - the node
Method Detail

getConditionAsString

public java.lang.String getConditionAsString()
Gets the condition as string representation.

Returns:
the condition as string

getConditionAsNode

public ConditionNode getConditionAsNode()
Gets the condition as ConditionNode representation.

Returns:
the condition as

eval

public boolean eval()
             throws java.lang.NullPointerException
Evaluates the condition of a task, if the values are set using the setValue() operations. See ConditionAST.evalAST(ConditionNode, Map) for more information. The task is set internally, when setting the conditions.

Returns:
true, if successful
Throws:
java.lang.NullPointerException - if the task is not set

toString

public java.lang.String toString()
Gets the condition as string representation.

Overrides:
toString in class java.lang.Object
Returns:
the condition as