Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.

fj.function
Class Booleans

java.lang.Object
  extended by fj.function.Booleans

public final class Booleans
extends Object

Curried logical functions.


Field Summary
static F<Boolean,F<Boolean,Boolean>> and
          Curried form of logical "and" (conjunction).
static F<Boolean,F<Boolean,Boolean>> if_
          Curried form of logical "if" (reverse material implication).
static F<Boolean,F<Boolean,Boolean>> iff
          Curried form of logical "if and only if" (biconditional, equivalence).
static F<Boolean,F<Boolean,Boolean>> implies
          Curried form of logical "only if" (material implication).
static F<Boolean,F<Boolean,Boolean>> nif
          Curried form of logical "not if" (reverse nonimplication).
static F<Boolean,F<Boolean,Boolean>> nimp
          Curried form of logical "not implies" (nonimplication).
static F<Boolean,F<Boolean,Boolean>> nor
          Curried form of logical "not or".
static F<Boolean,Boolean> not
          Logical negation.
static F<Boolean,F<Boolean,Boolean>> or
          Curried form of logical "inclusive or" (disjunction).
static F<Boolean,F<Boolean,Boolean>> xor
          Curried form of logical xor (nonequivalence).
 
Method Summary
static boolean and(List<Boolean> l)
          Returns true if all the elements of the given list are true.
static boolean and(Stream<Boolean> l)
          Returns true if all the elements of the given stream are true.
static
<A> F<Boolean,F<A,F<A,A>>>
cond()
          Curried form of conditional.
static
<A> F<A,Boolean>
not(F<A,Boolean> p)
          Negates the given predicate.
static boolean or(List<Boolean> l)
          Returns true if any element of the given list is true.
static boolean or(Stream<Boolean> l)
          Returns true if any element of the given stream is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

or

public static final F<Boolean,F<Boolean,Boolean>> or
Curried form of logical "inclusive or" (disjunction).


and

public static final F<Boolean,F<Boolean,Boolean>> and
Curried form of logical "and" (conjunction).


xor

public static final F<Boolean,F<Boolean,Boolean>> xor
Curried form of logical xor (nonequivalence).


not

public static final F<Boolean,Boolean> not
Logical negation.


implies

public static final F<Boolean,F<Boolean,Boolean>> implies
Curried form of logical "only if" (material implication).


if_

public static final F<Boolean,F<Boolean,Boolean>> if_
Curried form of logical "if" (reverse material implication).


iff

public static final F<Boolean,F<Boolean,Boolean>> iff
Curried form of logical "if and only if" (biconditional, equivalence).


nimp

public static final F<Boolean,F<Boolean,Boolean>> nimp
Curried form of logical "not implies" (nonimplication).


nif

public static final F<Boolean,F<Boolean,Boolean>> nif
Curried form of logical "not if" (reverse nonimplication).


nor

public static final F<Boolean,F<Boolean,Boolean>> nor
Curried form of logical "not or".

Method Detail

and

public static boolean and(List<Boolean> l)
Returns true if all the elements of the given list are true.

Parameters:
l - A list to check for all the elements being true.
Returns:
true if all the elements of the given list are true. False otherwise.

and

public static boolean and(Stream<Boolean> l)
Returns true if all the elements of the given stream are true.

Parameters:
l - A stream to check for all the elements being true.
Returns:
true if all the elements of the given stream are true. False otherwise.

or

public static boolean or(List<Boolean> l)
Returns true if any element of the given list is true.

Parameters:
l - A list to check for any element being true.
Returns:
true if any element of the given list is true. False otherwise.

or

public static boolean or(Stream<Boolean> l)
Returns true if any element of the given stream is true.

Parameters:
l - A stream to check for any element being true.
Returns:
true if any element of the given stream is true. False otherwise.

not

public static <A> F<A,Boolean> not(F<A,Boolean> p)
Negates the given predicate.

Parameters:
p - A predicate to negate.
Returns:
The negation of the given predicate.

cond

public static <A> F<Boolean,F<A,F<A,A>>> cond()
Curried form of conditional. If the first argument is true, returns the second argument, otherwise the third argument.

Returns:
A function that returns its second argument if the first argument is true, otherwise the third argument.

Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.