uk.co.jezuk.mango
Class Bind

java.lang.Object
  extended byuk.co.jezuk.mango.Bind

public class Bind
extends java.lang.Object

Function and Predicate binding adaptors.

Version:
$Id: Bind.java 56 2002-06-12 11:29:55Z jez $
Author:
Jez Higgins, jez@jezuk.co.uk

Method Summary
static UnaryFunction First(BinaryFunction f, java.lang.Object c)
          Adapts a BinaryFunction into a UnaryFunction.
static Predicate First(BinaryPredicate p, java.lang.Object c)
          Special case which adapts a BinaryPredicate to a Predicate.
static UnaryFunction Second(BinaryFunction f, java.lang.Object c)
          Adapts a BinaryFunction into a UnaryFunction.
static Predicate Second(BinaryPredicate p, java.lang.Object c)
          Special case which adapts a BinaryPredicate to a Predicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

First

public static UnaryFunction First(BinaryFunction f,
                                  java.lang.Object c)
Adapts a BinaryFunction into a UnaryFunction. If f is an object implementing BinaryFunction, then Bind.First(f, C).fn(arg) returns f(C, arg).

Intuitively, you can think of this as "binding" the first argument of a BinaryFunction to a constant, thus giving a UnaryFunction.


First

public static Predicate First(BinaryPredicate p,
                              java.lang.Object c)
Special case which adapts a BinaryPredicate to a Predicate. If p is a BinaryPredicate, then Bind.First(p, C).test(arg) returns p.test(C, arg).


Second

public static UnaryFunction Second(BinaryFunction f,
                                   java.lang.Object c)
Adapts a BinaryFunction into a UnaryFunction. If f is an object implementing BinaryFunction, then Bind.Second(f, C).fn(arg) returns f(arg, C).

Intuitively, you can think of this as "binding" the second argument of a BinaryFunction to a constant, thus giving a UnaryFunction.


Second

public static Predicate Second(BinaryPredicate p,
                               java.lang.Object c)
Special case which adapts a BinaryPredicate to a Predicate. If p is a BinaryPredicate, then Bind.Second(p, C).test(arg) returns p.test(arg, C).



Copyright © 2002-2006 JezUK Ltd.