home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Extras / OSpace / jgl.exe / jgl_2_0 / src / COM / objectspace / jgl / BindFirstPredicate.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  1.4 KB  |  45 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2. // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
  3.  
  4. package COM.objectspace.jgl;
  5.  
  6. /**
  7.  * BindFirstPredicate is a unary predicate object that allows you to apply a binary
  8.  * predicate to a predefined value and an operand. The reason that it's called
  9.  * BindFirstPredicate is that the predefined value is always used as the 1st parameter
  10.  * to the binary predicate.
  11.  * <p>
  12.  * @see COM.objectspace.jgl.BindFirst
  13.  * @see COM.objectspace.jgl.BindSecondPredicate
  14.  * @version 2.0.2
  15.  * @author ObjectSpace, Inc.
  16.  */
  17.  
  18. public final class BindFirstPredicate implements UnaryPredicate
  19.   {
  20.   BinaryPredicate myPredicate;
  21.   Object myObject;
  22.  
  23.   /**
  24.    * Construct myself with a binary predicate object and a predefined value.
  25.    * @param predicate The binary predicate object.
  26.    * @param value The object to use as the 1st parameter.
  27.    */
  28.   public BindFirstPredicate( BinaryPredicate predicate, Object value )
  29.     {
  30.     myPredicate = predicate;
  31.     myObject = value;
  32.     }
  33.  
  34.   /**
  35.    * Perform my binary predicate on the operand using the predefined value as the 1st
  36.    * parameter and the operand as the 2nd parameter.
  37.    * @param object The operand.
  38.    * @return predicate( value, object )
  39.    */
  40.   public boolean execute( Object object )
  41.     {
  42.     return myPredicate.execute( myObject, object );
  43.     }
  44.   }
  45.