com.ibm.retail.AEF.automation
Class AndThenCondition

java.lang.Object
  |
  +--com.ibm.retail.AEF.automation.AbstractCondition
        |
        +--com.ibm.retail.AEF.automation.AndThenCondition
All Implemented Interfaces:
Condition, com.ibm.retail.AEF.automation.EvaluateConditionListener

public class AndThenCondition
extends AbstractCondition
implements Condition, com.ibm.retail.AEF.automation.EvaluateConditionListener

AndThenCondition uses an array of PropertyConditions. When the first condition evaluates true, the second is elligible for evaluation and so on. When the entire collection of conditions evaluates to true, then the lock associated with this condition is notified.


Field Summary
protected  int childIndex
           
protected  com.ibm.retail.AEF.automation.Condition[] conditions
           
 
Fields inherited from class com.ibm.retail.AEF.automation.AbstractCondition
counterLock, dataProvider, eligible, id, idCounter, index, listeners, lock, manager, session
 
Constructor Summary
AndThenCondition(com.ibm.retail.AEF.automation.Condition[] conditions)
          Constructs the condition
 
Method Summary
 void conditionEvaluated(com.ibm.retail.AEF.automation.Condition condition, boolean flag)
          Called by a condition when the condition is evaluated.
(package private) static java.lang.String copyright()
           
 void currentValues(java.util.HashMap values)
          Populate the HashMap with property name/current value pairs included in the condition.
 boolean evaluate()
          Examines each of the child conditions immediately and determines whether they are all true.
 boolean evaluate(com.ibm.retail.AEF.automation.Condition truecond)
          Examines each of the child conditions immediately and determines whether they are all true, with the exception of the argument condition.
 boolean evaluateValues(com.ibm.retail.AEF.automation.Condition truecond)
          Determines whether all the conditions as observed are currently true, and signals the lock to release any blocked threads if they are all true.
 java.lang.String explain()
          Returns a string explaining this condition.
 com.ibm.retail.AEF.automation.Condition makeOpposite()
          Makes a new condition which is the logical opposite of this condition.
 void setConditionLock(com.ibm.retail.AEF.thread.ConditionLock lock)
          Sets the condition lock associated with this object.
 void setEligible(boolean flag)
          Sets the condition eligible for evaluation.
 void setPOSDataProvider(com.ibm.retail.AEF.data.POSDataProvider dataProvider)
          Sets the POSDataProvider associated with this condition.
 
Methods inherited from class com.ibm.retail.AEF.automation.AbstractCondition
addEvaluateListener, getID, getIndex, getNextID, getPOSDataProvider, getSession, getTerminalNumber, isEligible, notifyEvaluateConditionListeners, removeEvaluateListener, setID, setIndex, setLockManager, setSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.retail.AEF.automation.Condition
addEvaluateListener, getID, getIndex, getPOSDataProvider, getSession, getTerminalNumber, isEligible, removeEvaluateListener, setID, setIndex, setLockManager, setSession
 

Field Detail

conditions

protected com.ibm.retail.AEF.automation.Condition[] conditions

childIndex

protected int childIndex
Constructor Detail

AndThenCondition

public AndThenCondition(com.ibm.retail.AEF.automation.Condition[] conditions)
Constructs the condition

Parameters:
conditions - An array of Condition objects. All of the conditions must evaluate to true for this AndThenCondition to evaluate to true.
Method Detail

copyright

static java.lang.String copyright()

setPOSDataProvider

public void setPOSDataProvider(com.ibm.retail.AEF.data.POSDataProvider dataProvider)
Sets the POSDataProvider associated with this condition.

Specified by:
setPOSDataProvider in interface Condition
Overrides:
setPOSDataProvider in class AbstractCondition
Parameters:
dataProvider - The POSDataProvider which will provide property change events to this condition.

conditionEvaluated

public void conditionEvaluated(com.ibm.retail.AEF.automation.Condition condition,
                               boolean flag)
Called by a condition when the condition is evaluated.

Specified by:
conditionEvaluated in interface com.ibm.retail.AEF.automation.EvaluateConditionListener
Parameters:
condition - Called by one of the child conditions when it is evaluated.
flag - Indicates whether the child condition evaluated to true or false.

setEligible

public void setEligible(boolean flag)
Sets the condition eligible for evaluation.

Specified by:
setEligible in interface Condition
Overrides:
setEligible in class AbstractCondition
Parameters:
flag - Set to true to make this condition eligible for evaluation.

evaluate

public boolean evaluate()
Examines each of the child conditions immediately and determines whether they are all true.

Specified by:
evaluate in interface Condition
Returns:
boolean True if the condition evaluates to true.

evaluate

public boolean evaluate(com.ibm.retail.AEF.automation.Condition truecond)
Examines each of the child conditions immediately and determines whether they are all true, with the exception of the argument condition.

Parameters:
truecond -
Returns:
boolean True if the condition evaluates to true.

evaluateValues

public boolean evaluateValues(com.ibm.retail.AEF.automation.Condition truecond)
Determines whether all the conditions as observed are currently true, and signals the lock to release any blocked threads if they are all true.

Parameters:
truecond - The original condition of the group which evaluated true.
Returns:
boolean True if the condition evaluates to true.

makeOpposite

public com.ibm.retail.AEF.automation.Condition makeOpposite()
Makes a new condition which is the logical opposite of this condition.

Specified by:
makeOpposite in interface Condition
Returns:
Condition

explain

public java.lang.String explain()
Returns a string explaining this condition.

Specified by:
explain in interface Condition
Returns:
String

currentValues

public void currentValues(java.util.HashMap values)
Populate the HashMap with property name/current value pairs included in the condition. If a key is already in the HashMap, the new value will not override the value already in the map for the key.

Specified by:
currentValues in interface Condition
Parameters:
values -

setConditionLock

public void setConditionLock(com.ibm.retail.AEF.thread.ConditionLock lock)
Sets the condition lock associated with this object.

Specified by:
setConditionLock in interface Condition
Overrides:
setConditionLock in class AbstractCondition
Parameters:
lock -


Copyright © 2004 IBM. All Rights Reserved.
Generated: July 19 2004