Class Conditional

java.lang.Object
org.apache.commons.functor.core.composite.Conditional

public final class Conditional extends Object
Utility methods for creating conditional functors.
Version:
$Revision$ $Date$
  • Constructor Details

    • Conditional

      public Conditional()

      Conditional instances should NOT be constructed in standard programming. Instead, the methods of the class should be invoked statically.

      This constructor is public to permit tools that require a JavaBean instance to operate.

  • Method Details

    • procedure

      public static Procedure procedure(Predicate q, Procedure r)
      Create a guarded Procedure.
      Parameters:
      q - if
      r - then
      Returns:
      Procedure
    • procedure

      public static Procedure procedure(Predicate q, Procedure r, Procedure s)
      Create a conditional Procedure.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      Procedure
    • function

      public static <T> Function<T> function(Predicate q, Function<? extends T> r, Function<? extends T> s)
      Create a conditional Function.
      Type Parameters:
      T - the input functions parameter type
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      Function
    • predicate

      public static Predicate predicate(Predicate q, Predicate r, Predicate s)
      Create a conditional Predicate.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      Predicate
    • procedure

      public static <A> UnaryProcedure<A> procedure(UnaryPredicate<? super A> q, UnaryProcedure<? super A> r)
      Create a guarded UnaryProcedure.
      Type Parameters:
      A - the predicates argument type.
      Parameters:
      q - if
      r - then
      Returns:
      UnaryProcedure
    • procedure

      public static <A> UnaryProcedure<A> procedure(UnaryPredicate<? super A> q, UnaryProcedure<? super A> r, UnaryProcedure<? super A> s)
      Create a conditional UnaryProcedure.
      Type Parameters:
      A - the predicates argument type.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      UnaryProcedure
    • function

      public static <A,T> UnaryFunction<A,T> function(UnaryPredicate<? super A> q, UnaryFunction<? super A, ? extends T> r, UnaryFunction<? super A, ? extends T> s)
      Create a conditional UnaryFunction.
      Type Parameters:
      A - the predicates argument type.
      T - the output function returned value type.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      UnaryFunctioninvalid input: '<'A, T>
    • predicate

      public static <A> UnaryPredicate<A> predicate(UnaryPredicate<? super A> q, UnaryPredicate<? super A> r, UnaryPredicate<? super A> s)
      Create a conditional UnaryPredicate.
      Type Parameters:
      A - the predicates argument type.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      UnaryPredicate
    • procedure

      public static <L,R> BinaryProcedure<L,R> procedure(BinaryPredicate<? super L, ? super R> q, BinaryProcedure<? super L, ? super R> r)
      Create a guarded BinaryProcedure.
      Type Parameters:
      L - the left argument type.
      R - the right argument type.
      Parameters:
      q - if
      r - then
      Returns:
      BinaryProcedureinvalid input: '<'L, R>
    • procedure

      public static <L,R> BinaryProcedure<L,R> procedure(BinaryPredicate<? super L, ? super R> q, BinaryProcedure<? super L, ? super R> r, BinaryProcedure<? super L, ? super R> s)
      Create a conditional BinaryProcedure.
      Type Parameters:
      L - the left argument type.
      R - the right argument type.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      BinaryProcedureinvalid input: '<'L, R>
    • function

      public static <L,R,T> BinaryFunction<L,R,T> function(BinaryPredicate<? super L, ? super R> q, BinaryFunction<? super L, ? super R, ? extends T> r, BinaryFunction<? super L, ? super R, ? extends T> s)
      Create a conditional BinaryFunction.
      Type Parameters:
      L - the left argument type.
      R - the right argument type.
      T - the output function returned value type.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      BinaryFunctioninvalid input: '<'L, R, T>
    • predicate

      public static <L,R> BinaryPredicate<L,R> predicate(BinaryPredicate<? super L, ? super R> q, BinaryPredicate<? super L, ? super R> r, BinaryPredicate<? super L, ? super R> s)
      Create a conditional BinaryPredicate.
      Type Parameters:
      L - the left argument type.
      R - the right argument type.
      Parameters:
      q - if
      r - then
      s - else
      Returns:
      BinaryPredicateinvalid input: '<'L, R>