org.op4j.functions
Class FnBoolean

Object
  extended by org.op4j.functions.FnBoolean

public final class FnBoolean
extends Object

Since:
1.0
Author:
Soraya Sánchez

Method Summary
static
<X,R extends X>
Function<R,Boolean>
and(IFunction<X,Boolean> left, IFunction<? super R,Boolean> right)
           Takes two boolean functions (Function<?
static Function<Object,Boolean> eq(boolean object)
           Determines whether the target object and the specified object are equal by calling the equals method on the target object.
static Function<Object,Boolean> eq(Boolean object)
           Determines whether the target object and the specified object are equal by calling the equals method on the target object.
static
<X> Function<X,Boolean>
eqBy(IFunction<X,?> by, boolean object)
           Determines whether the result of executing the specified function on the target object and the specified object parameter are equal by calling the equals method.
static
<X> Function<X,Boolean>
eqBy(IFunction<X,?> by, Boolean object)
           Determines whether the result of executing the specified function on the target object and the specified object parameter are equal by calling the equals method.
static Function<Boolean,Boolean> isFalse()
           Returns true if the target object is Boolean.FALSE, false if it is Boolean.TRUE.
static Function<Object,Boolean> isNotNull()
           Determines whether the target object is null or not.
static
<X> Function<X,Boolean>
isNotNullBy(IFunction<X,?> by)
           Determines whether the result of executing the specified function on the target object is null or not.
static Function<Object,Boolean> isNull()
           Determines whether the target object is null or not.
static
<X> Function<X,Boolean>
isNullBy(IFunction<X,?> by)
           Determines whether the result of executing the specified function on the target object is null or not.
static Function<Boolean,Boolean> isTrue()
           Returns true if the target object is Boolean.TRUE, false if it is Boolean.FALSE.
static Function<Boolean,Boolean> negate()
           Negates the target Boolean, returning Boolean.FALSE if the target object is Boolean.TRUE, and Boolean.TRUE if it is Boolean.FALSE.
static
<T> Function<T,Boolean>
not(IFunction<T,Boolean> function)
           Takes a boolean function (Function<?
static Function<Object,Boolean> notEq(boolean object)
           Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object.
static Function<Object,Boolean> notEq(Boolean object)
           Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object.
static
<X> Function<X,Boolean>
notEqBy(IFunction<X,?> by, boolean object)
           Determines whether the result of executing the specified function on the target object and the specified object parameter are NOT equal by calling the equals method.
static
<X> Function<X,Boolean>
notEqBy(IFunction<X,?> by, Boolean object)
           Determines whether the result of executing the specified function on the target object and the specified object parameter are NOT equal by calling the equals method.
static
<X,R extends X>
Function<R,Boolean>
or(IFunction<X,Boolean> left, IFunction<? super R,Boolean> right)
           Takes two boolean functions (Function<?
static Function<Boolean,BigDecimal> toBigDecimal()
           Converts a Boolean to a BigDecimal. true = 1, false = 0.
static Function<Boolean,BigInteger> toBigInteger()
           Converts a Boolean to a BigInteger. true = 1, false = 0.
static Function<Boolean,Byte> toByte()
           Converts a Boolean to a Byte. true = 1, false = 0.
static Function<Boolean,Double> toDouble()
           Converts a Boolean to a Double. true = 1, false = 0.
static Function<Boolean,Float> toFloat()
           Converts a Boolean to a Float. true = 1, false = 0.
static Function<Boolean,Integer> toInteger()
           Converts a Boolean to a Integer. true = 1, false = 0.
static Function<Boolean,Long> toLong()
           Converts a Boolean to a Long. true = 1, false = 0.
static Function<Boolean,Short> toShort()
           Converts a Boolean to a Short. true = 1, false = 0.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toBigDecimal

public static final Function<Boolean,BigDecimal> toBigDecimal()

Converts a Boolean to a BigDecimal. true = 1, false = 0.

Returns:
a BigDecimal representing the boolean target.

toBigInteger

public static final Function<Boolean,BigInteger> toBigInteger()

Converts a Boolean to a BigInteger. true = 1, false = 0.

Returns:
a BigInteger representing the boolean target.

toDouble

public static final Function<Boolean,Double> toDouble()

Converts a Boolean to a Double. true = 1, false = 0.

Returns:
a Double representing the boolean target.

toFloat

public static final Function<Boolean,Float> toFloat()

Converts a Boolean to a Float. true = 1, false = 0.

Returns:
a Float representing the boolean target.

toLong

public static final Function<Boolean,Long> toLong()

Converts a Boolean to a Long. true = 1, false = 0.

Returns:
a Long representing the boolean target.

toInteger

public static final Function<Boolean,Integer> toInteger()

Converts a Boolean to a Integer. true = 1, false = 0.

Returns:
a Integer representing the boolean target.

toShort

public static final Function<Boolean,Short> toShort()

Converts a Boolean to a Short. true = 1, false = 0.

Returns:
a Short representing the boolean target.

toByte

public static final Function<Boolean,Byte> toByte()

Converts a Boolean to a Byte. true = 1, false = 0.

Returns:
a Byte representing the boolean target.

negate

public static final Function<Boolean,Boolean> negate()

Negates the target Boolean, returning Boolean.FALSE if the target object is Boolean.TRUE, and Boolean.TRUE if it is Boolean.FALSE.

Returns:
the negation of the target object.

eq

public static final Function<Object,Boolean> eq(Boolean object)

Determines whether the target object and the specified object are equal by calling the equals method on the target object.

Parameters:
object - the object to compare to the target
Returns:
true if both objects are equal, false if not.

eq

public static final Function<Object,Boolean> eq(boolean object)

Determines whether the target object and the specified object are equal by calling the equals method on the target object.

Parameters:
object - the object to compare to the target
Returns:
true if both objects are equal, false if not.

notEq

public static final Function<Object,Boolean> notEq(Boolean object)

Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object.

Parameters:
object - the object to compare to the target
Returns:
false if both objects are equal, true if not.

notEq

public static final Function<Object,Boolean> notEq(boolean object)

Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object.

Parameters:
object - the object to compare to the target
Returns:
false if both objects are equal, true if not.

eqBy

public static final <X> Function<X,Boolean> eqBy(IFunction<X,?> by,
                                                 Boolean object)

Determines whether the result of executing the specified function on the target object and the specified object parameter are equal by calling the equals method.

Parameters:
object - the object to compare to the target
Returns:
true if both objects are equal, false if not.

eqBy

public static final <X> Function<X,Boolean> eqBy(IFunction<X,?> by,
                                                 boolean object)

Determines whether the result of executing the specified function on the target object and the specified object parameter are equal by calling the equals method.

Parameters:
object - the object to compare to the target
Returns:
true if both objects are equal, false if not.

notEqBy

public static final <X> Function<X,Boolean> notEqBy(IFunction<X,?> by,
                                                    Boolean object)

Determines whether the result of executing the specified function on the target object and the specified object parameter are NOT equal by calling the equals method.

Parameters:
object - the object to compare to the target
Returns:
false if both objects are equal, true if not.

notEqBy

public static final <X> Function<X,Boolean> notEqBy(IFunction<X,?> by,
                                                    boolean object)

Determines whether the result of executing the specified function on the target object and the specified object parameter are NOT equal by calling the equals method.

Parameters:
object - the object to compare to the target
Returns:
false if both objects are equal, true if not.

isTrue

public static final Function<Boolean,Boolean> isTrue()

Returns true if the target object is Boolean.TRUE, false if it is Boolean.FALSE.

Returns:
true if the target object is Boolean.TRUE, false if Boolean.FALSE

isFalse

public static final Function<Boolean,Boolean> isFalse()

Returns true if the target object is Boolean.FALSE, false if it is Boolean.TRUE.

Returns:
true if the target object is Boolean.FALSE, false if Boolean.TRUE

and

public static final <X,R extends X> Function<R,Boolean> and(IFunction<X,Boolean> left,
                                                            IFunction<? super R,Boolean> right)

Takes two boolean functions (Function<?,Boolean>) as parameters and returns another one which returns true if both functions return true, and false if not.

Parameters:
left - the left side of the "and" operation
right - the right side of the "and" operation
Returns:
a function returning true if both functions return true, and false if not.

or

public static final <X,R extends X> Function<R,Boolean> or(IFunction<X,Boolean> left,
                                                           IFunction<? super R,Boolean> right)

Takes two boolean functions (Function<?,Boolean>) as parameters and returns another one which returns true if any of the functions returns true, and false if not.

Parameters:
left - the left side of the "or" operation
right - the right side of the "or" operation
Returns:
a function returning true if any of the functions return true, and false if not.

not

public static final <T> Function<T,Boolean> not(IFunction<T,Boolean> function)

Takes a boolean function (Function<?,Boolean>) as a parameter and returns another one which returns true if the specified function returns false, and false if the function returns true.

Parameters:
function - the function to be negated
Returns:
a function returning true if the specified function returns false, and false if it returns true.

isNull

public static final Function<Object,Boolean> isNull()

Determines whether the target object is null or not.

Returns:
true if the target object is null, false if not.

isNotNull

public static final Function<Object,Boolean> isNotNull()

Determines whether the target object is null or not.

Returns:
false if the target object is null, true if not.

isNullBy

public static final <X> Function<X,Boolean> isNullBy(IFunction<X,?> by)

Determines whether the result of executing the specified function on the target object is null or not.

Returns:
true if the function result is null, false if not.

isNotNullBy

public static final <X> Function<X,Boolean> isNotNullBy(IFunction<X,?> by)

Determines whether the result of executing the specified function on the target object is null or not.

Returns:
false if the function result is null, true if not.


Copyright © 2012 The OP4J team. All Rights Reserved.