org.eclipse.emf.query.conditions
Class Condition

java.lang.Object
  extended by org.eclipse.emf.query.conditions.Condition
Direct Known Subclasses:
DataTypeCondition, EObjectCondition, Not, ObjectInstanceCondition

public abstract class Condition
extends Object

An abstract base class for all Condition objects. It provides the basic functionality and support for conditions and their logical connectives that are used to combine Condition objects together. It answers whether a given Object satisfies it or not. This class is intended to be subclassed by clients.


Field Summary
static Condition FALSE
          A constant Condition object used to indicate a never satisfied condition
static Condition TRUE
          A constant Condition object used to indicate an always satisfied condition
 
Constructor Summary
protected Condition()
          A simple constructor.
 
Method Summary
 Condition AND(Condition condition)
          This operation acts like a logical AND between this Condition and the argument Condition.
 Condition EQUIVALENT(Condition condition)
          This operation acts like a logical Equivalent (if-and-only-if)/( <->) between this Condition and the argument Condition.
 Condition IMPLIES(Condition condition)
          This operation acts like a logical Implies (if-then)/(->) between this Condition and the argument Condition.
abstract  boolean isSatisfied(Object object)
          This operation is the evaluation operation of this Condition in regard to the argument Object.
 Condition OR(Condition condition)
          This operation acts like a logical OR between this Condition and the argument Condition.
 Condition XOR(Condition condition)
          This operation acts like a logical XOR between this Condition and the argument Condition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final Condition TRUE
A constant Condition object used to indicate an always satisfied condition


FALSE

public static final Condition FALSE
A constant Condition object used to indicate a never satisfied condition

Constructor Detail

Condition

protected Condition()
A simple constructor.

Method Detail

AND

public Condition AND(Condition condition)
This operation acts like a logical AND between this Condition and the argument Condition. The returned Condition is a newly created Condition which is satisfied only if both its constituent Condition s are.

Please note that the newly compounded Condition will evaluate this Condition first, and if the result is true, it will evaluate the argument Condition ANDing both results as its own final result. This means that the argument Condition could be short-circuited and might not be evaluated at all.

Parameters:
condition - a Condition to be ANDed with this one.
Returns:
a new compounded Condition object that represents the ANDing of this Condition with the argument Condition.

OR

public Condition OR(Condition condition)
This operation acts like a logical OR between this Condition and the argument Condition. The returned Condition is a newly created Condition which is satisfied if either of its constituent Condition s is. Please note that the newly compounded Condition will evaluate this Condition first, and if the result is true, it won't evaluate the argument Condition and it will return true as its final result, if, on the other hand the evaluation of the first Condition is false, the argument Condition will be evaluated and its returned result will be ORed with this one's and the resulting boolean will be returned as the compounded Condition own final result. This means that the argument Condition could be short-circuited and might not be evaluated at all.

Parameters:
condition - a Condition to be ORed with this one.
Returns:
a new compounded Condition object that represents the ORing of this Condition with the argument Condition.

XOR

public Condition XOR(Condition condition)
This operation acts like a logical XOR between this Condition and the argument Condition. The returned Condition is a newly created Condition which is satisfied if XORing its constituent Condition s is.

Parameters:
condition - a Condition to be XORed with this one.
Returns:
a new compounded Condition object that represents the XORing of this Condition with the argument Condition.

IMPLIES

public Condition IMPLIES(Condition condition)
This operation acts like a logical Implies (if-then)/(->) between this Condition and the argument Condition. The returned Condition is a newly created Condition which is satisfied if the result of this Condition's evaluation is false, in which case the argument Condition will not be evaluated at all, or, if the both its constituent Condition s evaluate to true.

Parameters:
condition - a Condition to be used in the Imply relation with this one.
Returns:
a new compounded Condition object that represents the Imply logical relation between this Condition and the argument Condition.

EQUIVALENT

public Condition EQUIVALENT(Condition condition)
This operation acts like a logical Equivalent (if-and-only-if)/( <->) between this Condition and the argument Condition. The returned Condition is a newly created Condition which is satisfied if the result of both its constituent Condition s evaluate to the same value.(both are true, or both are false)

Parameters:
condition - a Condition to be used in the Equivalent relation with this one.
Returns:
a new compounded Condition object that represents the Equivalent logical relation between this Condition and the argument Condition.

isSatisfied

public abstract boolean isSatisfied(Object object)
This operation is the evaluation operation of this Condition in regard to the argument Object. In other words, the operation answers whether the argument Object satisfied this Condition or not.

Parameters:
object - an Object to check if it satisfies this Condition
Returns:
true if the argument Object satisfies this Condition,false otherwise.

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