org.eclipse.emf.query.conditions
Class ConditionPolicy

java.lang.Object
  extended by org.eclipse.emf.query.conditions.ConditionPolicy

public abstract class ConditionPolicy
extends Object

An abstract base class for ConditionPolicy objects. ConditionPolicy objects are used to help a given Condition decide on how it should be evaluated as a whole whenever it is applied over multiple argument objects, since the Condition could evaluate to true on some of these objects and false on others. Clients can use the supplied ConditionPolicy objects or write their own subclasses to handle complex cases.


Field Summary
static ConditionPolicy ALL
          A utility ConditionPolicy object to be used when the client deems that the resultant evaluation is true if and only if: the Condition object evaluates to true on all the argument objects, or, when the client wants that all the Condition objects evaluate to true on the argument object
static ConditionPolicy ANY
          A utility ConditionPolicy object to be used when the client deems that the resultant evaluation is true if and only if: the Condition object evaluates to true on any of the argument objects, or, when the client wants that any of the Condition objects to evaluate to true on the argument object
 
Constructor Summary
protected ConditionPolicy()
          A simple constructor
 
Method Summary
abstract  boolean isSatisfied(Condition[] conditions, Object object)
          Answers whether the argument conditions evaluate -collectively- to true or false when applied to the argument object.
abstract  boolean isSatisfied(Condition condition, Collection<?> objects)
          Answers on how the argument Condition evaluates as a whole on the argument objects collection.
 boolean isSatisfied(Condition condition, Object object)
          Answers whether the argument conditions evaluates to true or false when applied to the argument object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final ConditionPolicy ALL
A utility ConditionPolicy object to be used when the client deems that the resultant evaluation is true if and only if: the Condition object evaluates to true on all the argument objects, or, when the client wants that all the Condition objects evaluate to true on the argument object


ANY

public static final ConditionPolicy ANY
A utility ConditionPolicy object to be used when the client deems that the resultant evaluation is true if and only if: the Condition object evaluates to true on any of the argument objects, or, when the client wants that any of the Condition objects to evaluate to true on the argument object

Constructor Detail

ConditionPolicy

protected ConditionPolicy()
A simple constructor

Method Detail

isSatisfied

public abstract boolean isSatisfied(Condition condition,
                                    Collection<?> objects)
Answers on how the argument Condition evaluates as a whole on the argument objects collection.

Parameters:
condition - The Condition to be evaluated over the objects
objects - The collection of objects to be passed to the Condition argument for evaluation
Returns:
boolean true indicating that the Condition evaluated successfully on the argument objects -in accordance to this ConditionPolicy, false otherwise

isSatisfied

public abstract boolean isSatisfied(Condition[] conditions,
                                    Object object)
Answers whether the argument conditions evaluate -collectively- to true or false when applied to the argument object.

Parameters:
conditions - an array of Condition objects to be evaluated -collectively in accordance to this ConditionPolicy- on the argument object.
object - The object to be tested by the Condition objects
Returns:
boolean true indicating that the argument Condition objects evaluated successfully -in accordance to this ConditionPolicy- on the argument object, false otherwise

isSatisfied

public boolean isSatisfied(Condition condition,
                           Object object)
Answers whether the argument conditions evaluates to true or false when applied to the argument object. This is the simplest case of evaluation since it only involves one Condition and one object to test.

Parameters:
condition - The Condition to be evaluated over the object.
object - The object to be tested by the Condition object
Returns:
boolean true indicating that the argument Condition object evaluated successfully -in accordance to this ConditionPolicy- on the argument object, false otherwise

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.