com.maryanovsky.gwtutils.client
Class Condition<T>

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.Condition<T>

public abstract class Condition<T>
extends Object

A boolean condition.

Author:
Maryanovsky Alexander

Constructor Summary
Condition()
           
 
Method Summary
 Condition<T> and(Condition<? super T> cond)
          Returns the logical-AND of this condition and the specified one.
static
<T> Condition<T>
and(Condition<? super T> cond1, Condition<? super T> cond2)
          Returns the logical-AND of the specified conditions.
static
<T> Condition<T>
and(Condition<? super T> cond1, Condition<? super T> cond2, Condition<? super T> cond3)
          Returns the logical-AND of the specified conditions.
static
<T> Condition<T>
and(Condition<? super T> cond1, Condition<? super T> cond2, Condition<? super T> cond3, Condition<? super T> cond4)
          Returns the logical-AND of the specified conditions.
<S extends T>
Condition<S>
cast()
          Casts this condition to a condition parameterized with a subtype of T.
static
<T> Condition<T>
cast(Condition<? super T> condition)
          Casts a condition parameterized with a supertype of T to a condition parameterized with T.
abstract  boolean eval(T argument)
          Returns the value of the condition based on the specified argument.
static
<T> Condition<T>
falsehood()
          The always-false condition.
 Condition<T> not()
          Returns the logical inverse of this condition.
static
<T> Condition<T>
not(Condition<? super T> condition)
          Returns the logical inverse of the specified condition.
 Condition<T> or(Condition<? super T> cond)
          Returns the logical-OR of this condition and the specified one.
static
<T> Condition<T>
or(Condition<? super T> cond1, Condition<? super T> cond2)
          Returns the logical-OR of the specified conditions.
static
<T> Condition<T>
or(Condition<? super T> cond1, Condition<? super T> cond2, Condition<? super T> cond3)
          Returns the logical-OR of the specified conditions.
static
<T> Condition<T>
or(Condition<? super T> cond1, Condition<? super T> cond2, Condition<? super T> cond3, Condition<? super T> cond4)
          Returns the logical-OR of the specified conditions.
static
<T> Condition<T>
truth()
          The always-true condition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

public Condition()
Method Detail

truth

public static <T> Condition<T> truth()
The always-true condition.


falsehood

public static <T> Condition<T> falsehood()
The always-false condition.


and

public Condition<T> and(Condition<? super T> cond)
Returns the logical-AND of this condition and the specified one. Note that the evaluation of the conditions is short-circuited in the standard way and that this condition is evaluated first.


and

public static <T> Condition<T> and(Condition<? super T> cond1,
                                   Condition<? super T> cond2)
Returns the logical-AND of the specified conditions. Note that the evaluation of the conditions is short-circuited in the standard way.


and

public static <T> Condition<T> and(Condition<? super T> cond1,
                                   Condition<? super T> cond2,
                                   Condition<? super T> cond3)
Returns the logical-AND of the specified conditions. Note that the evaluation of the conditions is short-circuited in the standard way.


and

public static <T> Condition<T> and(Condition<? super T> cond1,
                                   Condition<? super T> cond2,
                                   Condition<? super T> cond3,
                                   Condition<? super T> cond4)
Returns the logical-AND of the specified conditions. Note that the evaluation of the conditions is short-circuited in the standard way.


or

public Condition<T> or(Condition<? super T> cond)
Returns the logical-OR of this condition and the specified one. Note that the evaluation of the conditions is short-circuited in the standard way and that this condition is evaluated first.


or

public static <T> Condition<T> or(Condition<? super T> cond1,
                                  Condition<? super T> cond2)
Returns the logical-OR of the specified conditions. Note that the evaluation of the conditions is short-circuited in the standard way.


or

public static <T> Condition<T> or(Condition<? super T> cond1,
                                  Condition<? super T> cond2,
                                  Condition<? super T> cond3)
Returns the logical-OR of the specified conditions. Note that the evaluation of the conditions is short-circuited in the standard way.


or

public static <T> Condition<T> or(Condition<? super T> cond1,
                                  Condition<? super T> cond2,
                                  Condition<? super T> cond3,
                                  Condition<? super T> cond4)
Returns the logical-OR of the specified conditions. Note that the evaluation of the conditions is short-circuited in the standard way.


not

public Condition<T> not()
Returns the logical inverse of this condition.


not

public static <T> Condition<T> not(Condition<? super T> condition)
Returns the logical inverse of the specified condition.


cast

public static <T> Condition<T> cast(Condition<? super T> condition)
Casts a condition parameterized with a supertype of T to a condition parameterized with T. This is legal, as a condition that evaluates an argument of a certain type can always evaluate an argument of its subtype.


cast

public <S extends T> Condition<S> cast()
Casts this condition to a condition parameterized with a subtype of T. This is legal as a condition can always be evaluated with a subtype of T.


eval

public abstract boolean eval(T argument)
Returns the value of the condition based on the specified argument.