org.yawlfoundation.yawl.worklet.support
Class ConditionEvaluator

java.lang.Object
  extended by org.yawlfoundation.yawl.worklet.support.ConditionEvaluator

public class ConditionEvaluator
extends Object

ConditionEvaluator is a member class of the Worklet Dynamic Selection Service. It is used here by the RdrNode class to evaluate the its condition and thus allow the rule traversal to occur. It takes an expression (provided as a String) and evaluates it to a boolean value. The datalist member is a JDOM Element that, if supplied, will be used to retrieve values for any variable names used in the expression. The expression may contain the following operators: - Arithmetic: * / + - - Comparison: = != > < >= <= - Logical: & | ! The order of precedence observed is: 1. * / 2. + - 3. the comparison operators 4. the logical operators Operands may be numeric literals, string literals or variable names. Parentheses may be used to group sub-expressions. An RdrConditionException will be raised if the expression is malformed or does not evaluate to a boolean value (see getMessage() for the kinds of things that can go wrong).

Author:
Michael Adams v0.8, 04-09/2006

Constructor Summary
ConditionEvaluator()
          CONSTRUCTORS
ConditionEvaluator(String cond, org.jdom.Element datalist)
           
 
Method Summary
 boolean evaluate()
          Evaluates a previously supplied condition using a previously supplied datalist.
 boolean evaluate(String cond, org.jdom.Element dlist)
          Evaluate the condition using the datalist of variables and values.
 String getCondition()
           
 org.jdom.Element getDataList()
           
static void main(String[] args)
           
 void setCondition(String cond)
          PUBLIC METHODS A - SETTERS & GETTERS
 void setDatalist(org.jdom.Element e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionEvaluator

public ConditionEvaluator()
CONSTRUCTORS


ConditionEvaluator

public ConditionEvaluator(String cond,
                          org.jdom.Element datalist)
Method Detail

setCondition

public void setCondition(String cond)
PUBLIC METHODS A - SETTERS & GETTERS


getCondition

public String getCondition()

setDatalist

public void setDatalist(org.jdom.Element e)

getDataList

public org.jdom.Element getDataList()

evaluate

public boolean evaluate()
                 throws RdrConditionException
Evaluates a previously supplied condition using a previously supplied datalist. Throws an RdrConditionException if those two items have not been previously supplied.

Throws:
RdrConditionException

evaluate

public boolean evaluate(String cond,
                        org.jdom.Element dlist)
                 throws RdrConditionException
Evaluate the condition using the datalist of variables and values.

Parameters:
cond - - the condition to evaluate
dlist - - the datalist of variables and values
Returns:
the boolean result of the evaluation
Throws:
RdrConditionException

main

public static void main(String[] args)


Copyright © 2004-2012 The YAWL Foundation.