commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject RE: [FUNCTOR] Does functor have a class for this?
Date Fri, 19 Mar 2004 12:50:21 GMT
Does nobody monitor the functor project?

-----Original Message-----
From: James Carman [mailto:james@carmanconsulting.com] 
Sent: Thursday, March 18, 2004 9:18 AM
To: commons-user@jakarta.apache.org
Subject: [FUNCTOR] Does functor have a class for this?

I want to turn a BinaryPredicate into a Predicate by using Functions for the
left/right operands to the BinaryPredicate.

 

public class BinaryPredicateToPredicate implements Predicate

{

  private final Function leftFunction;

  private final Function rightFunction;

  private final BinaryPredicate binaryPredicate;

 

  public BinaryPredicateToPredicate( BinaryPredicate binaryPredicate,
Function leftFunction, Function rightPredicate )

  {

    this.leftFunction = leftFunction;

    this.rightFunction = rightFunction;

    this.binaryPredicate = binaryPredicate;

  }

 

  public boolean test()

  {

    binaryPredicate.test( leftFunction.evaluate(), rightFunction.evaluate()
);

  }

}

 

Does the functor library already have something for this?

 




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message