org.decisiondeck.jmcda.utils
Class FunctionUtils

java.lang.Object
  extended by org.decisiondeck.jmcda.utils.FunctionUtils

public class FunctionUtils
extends Object


Constructor Summary
FunctionUtils()
           
 
Method Summary
static
<A,B,C> FunctionWithInputCheck<A,C>
compose(Function<B,? extends C> g, FunctionWithInputCheck<A,? extends B> f)
           
static
<A,B,C> FunctionWithInputCheck<A,C>
compose(FunctionWithInputCheck<B,? extends C> g, Function<A,? extends B> f)
           
static
<A,B,C> FunctionWithInputCheck<A,C>
compose(FunctionWithInputCheck<B,? extends C> g, FunctionWithInputCheck<A,? extends B> f)
           
static
<F,V> FunctionWithInputCheck<F,V>
constant(V value)
           
static
<F,F2 extends F,V2,V extends V2>
FunctionWithInputCheck<F2,V2>
functionWithInputCheck(Function<F,V> f)
          Transforms a function into a function with input check.
static
<E> FunctionWithInputCheck<E,E>
identity()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionUtils

public FunctionUtils()
Method Detail

compose

public static <A,B,C> FunctionWithInputCheck<A,C> compose(Function<B,? extends C> g,
                                                          FunctionWithInputCheck<A,? extends B> f)

compose

public static <A,B,C> FunctionWithInputCheck<A,C> compose(FunctionWithInputCheck<B,? extends C> g,
                                                          Function<A,? extends B> f)

compose

public static <A,B,C> FunctionWithInputCheck<A,C> compose(FunctionWithInputCheck<B,? extends C> g,
                                                          FunctionWithInputCheck<A,? extends B> f)

functionWithInputCheck

public static <F,F2 extends F,V2,V extends V2> FunctionWithInputCheck<F2,V2> functionWithInputCheck(Function<F,V> f)
Transforms a function into a function with input check. This is mainly intended as a technical method to provide type compatibility where a function with input check is expected instead of a function. The returned function does not throw InvalidInputExceptions.

Type Parameters:
F - the domain of the given function: the type of value it expects.
V - the codomain of the given function: the type of value it returns.
F2 - the domain of the returned function: the type of value it expects.
V2 - the codomain of the returned function: the type of value it returns.
Parameters:
f - not null.
Returns:
not null.

constant

public static <F,V> FunctionWithInputCheck<F,V> constant(V value)

identity

public static <E> FunctionWithInputCheck<E,E> identity()
Type Parameters:
E - the input and output type of the function.
Returns:
the identity function.


Copyright © 2011. All Rights Reserved.