com.myjavatools.lib.human
Class Logical

java.lang.Object
  extended by com.myjavatools.lib.human.Logical

public abstract class Logical
extends java.lang.Object

Logical is a class that represents a multivalued logic the mathematical notion of function: X -> Y. To implement a function, you need to define method apply(): Y y = function.apply(X x).

Since:
5.0
Version:
5.0, 11/15/04
See Also:
Filter, Maps, Map

Nested Class Summary
static class Logical.LogicalConstant
           
 
Constructor Summary
Logical()
           
 
Method Summary
static Logical.LogicalConstant and(Logical.LogicalConstant a, Logical.LogicalConstant b)
          Conjunction of two logical values
static
<T> Predicate<T>
and(Predicate<T> f, Predicate<T> g)
          Conjunction of two predicates
static Logical.LogicalConstant not(Logical.LogicalConstant a)
          Negation of a logical value
static
<T> Predicate<T>
not(Predicate<T> f)
          Negation of a predicate
static Logical.LogicalConstant or(Logical.LogicalConstant a, Logical.LogicalConstant b)
          Disjunction of two logical values
static
<T> Predicate<T>
or(Predicate<T> f, Predicate<T> g)
          Disjunction of two predicates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Logical

public Logical()
Method Detail

and

public static Logical.LogicalConstant and(Logical.LogicalConstant a,
                                          Logical.LogicalConstant b)
Conjunction of two logical values

Parameters:
a - LogicalConstant
b - LogicalConstant
Returns:
LogicalConstant that is a&b

or

public static Logical.LogicalConstant or(Logical.LogicalConstant a,
                                         Logical.LogicalConstant b)
Disjunction of two logical values

Parameters:
a - LogicalConstant
b - LogicalConstant
Returns:
LogicalConstant that is a|b

not

public static Logical.LogicalConstant not(Logical.LogicalConstant a)
Negation of a logical value

Parameters:
a - LogicalConstant
Returns:
LogicalConstant that is !a

and

public static <T> Predicate<T> and(Predicate<T> f,
                                   Predicate<T> g)
Conjunction of two predicates

Parameters:
f - Predicate
g - Predicate
Returns:
Predicate that is f & g

or

public static <T> Predicate<T> or(Predicate<T> f,
                                  Predicate<T> g)
Disjunction of two predicates

Parameters:
f - Predicate
g - Predicate
Returns:
Predicate that is f | g

not

public static <T> Predicate<T> not(Predicate<T> f)
Negation of a predicate

Parameters:
f - Predicate
Returns:
Predicate that is !f