com.googlecode.jbp.common.logic
Class BooleanFunctions

java.lang.Object
  extended by com.googlecode.jbp.common.logic.BooleanFunctions

public class BooleanFunctions
extends Object

Provides various boolean-valued methods.

Author:
Yannick LOTH - yannick AT littlej.biz -

Method Summary
static boolean conjunction(boolean... predicatesParam)
          Returns true if all specified predicates are true.
static boolean disjunction(boolean... predicatesParam)
          Returns true if at least on specified predicate is true.
static boolean equivalent(boolean... predicatesParam)
          Checks for predicate equivalence.
static boolean exclusiveDisjunction(boolean firstPredicateParam, boolean secondPredicateParam)
          Checks that exactly one predicate is true.
static boolean majority(boolean... predicatesParam)
          Checks that strictly more than half of the specified predicates are true.
static boolean nand(boolean firstPredicateParam, boolean secondPredicateParam)
          Checks that both specified predicates are not simultaneously true.
static boolean nor(boolean firstPredicateParam, boolean secondPredicateParam)
          Returns true if both specified predicates are simultaneously false.
static boolean[] not(boolean... predicatesParam)
          Returns an array with the opposites of the specified predicates.
static boolean not(boolean predicateParam)
          Returns the opposite of the specified predicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

conjunction

public static boolean conjunction(boolean... predicatesParam)
Returns true if all specified predicates are true.

Parameters:
predicatesParam - The specified predicates.

disjunction

public static boolean disjunction(boolean... predicatesParam)
Returns true if at least on specified predicate is true.

Parameters:
predicatesParam - The specified predicates.

equivalent

public static boolean equivalent(boolean... predicatesParam)
Checks for predicate equivalence.

Parameters:
predicatesParam - The specified predicates.
Returns:
true if all specified predicates are equivalent, false else.

exclusiveDisjunction

public static boolean exclusiveDisjunction(boolean firstPredicateParam,
                                           boolean secondPredicateParam)
Checks that exactly one predicate is true.

Parameters:
firstPredicateParam - The first predicate.
secondPredicateParam - The second predicate.
Returns:
true if exactly one specified predicate is true.

majority

public static boolean majority(boolean... predicatesParam)
Checks that strictly more than half of the specified predicates are true.

Parameters:
predicatesParam - The specified predicates.
Returns:
true if strictly more than half of the specified predicates are true, false else.

nand

public static boolean nand(boolean firstPredicateParam,
                           boolean secondPredicateParam)
Checks that both specified predicates are not simultaneously true.

Parameters:
firstPredicateParam - The first specified predicate.
secondPredicateParam - The second specified predicate.
Returns:
true if both specified predicates are not simultaneously true, false else.

nor

public static boolean nor(boolean firstPredicateParam,
                          boolean secondPredicateParam)
Returns true if both specified predicates are simultaneously false.

Parameters:
firstPredicateParam - The first specified predicate.
secondPredicateParam - The second specified predicate.
Returns:
true if both specified predicates are simultaneously false, false else.

not

public static boolean not(boolean predicateParam)
Returns the opposite of the specified predicate.

Parameters:
predicateParam - The specified predicate.
Returns:
true if the specified predicate is false or false if it's true.

not

public static boolean[] not(boolean... predicatesParam)
Returns an array with the opposites of the specified predicates.

Parameters:
predicatesParam - The specified predicates.
Returns:
An array with the opposites of the specified predicates. The order of the elements is unchanged.


Copyright © 2011. All Rights Reserved.