List of usage examples for org.apache.commons.functor.core.composite Composite function
public static <A, X, T> CompositeUnaryFunction<A, T> function(UnaryFunction<? super X, ? extends T> f, UnaryFunction<? super A, ? extends X> g)
From source file:org.apache.commons.functor.example.kata.four.DataMunger.java
/** * A Function that returns the absolute value of the difference * between the Integers stored in the <i>col1</i> and <i>col2</i>th * whitespace delimited columns of the input line (a String). *///from w w w. ja v a2s . c o m private static Function<String, Integer> absSpread(final int col1, final int col2) { return Composite.function(Abs.instance(), new BinaryFunctionFunction<String, Number>(Composite.function(Subtract.instance(), Composite.function(ToInteger.instance(), NthColumn.instance(col1)), Composite.function(ToInteger.instance(), NthColumn.instance(col2))))); }
From source file:org.apache.commons.functor.example.kata.one.ToMoney.java
public static <X> Function<X, Money> from(Function<? super X, ? extends Number> fn) { return Composite.function(INSTANCE, fn); }