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 / UnaryComposePredicate.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  1.2 KB  |  43 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.  * UnaryCompose is a unary predicate object that returns the result of executing
  8.  * two operations in a specific sequence.
  9.  * <p>
  10.  * @see COM.objectspace.jgl.UnaryComposePredicate
  11.  * @see COM.objectspace.jgl.BinaryCompose
  12.  * @version 2.0.2
  13.  * @author ObjectSpace, Inc.
  14.  */
  15.  
  16. public final class UnaryComposePredicate implements UnaryPredicate
  17.   {
  18.   UnaryPredicate myPredicate;
  19.   UnaryFunction myFunction;
  20.  
  21.   /**
  22.    * Construct myself with a unary predicate object and a unary function object.
  23.    * @param predicate The predicate object.
  24.    * @param function The function object.
  25.    */
  26.   public UnaryComposePredicate( UnaryPredicate predicate, UnaryFunction function )
  27.     {
  28.     myPredicate = predicate;
  29.     myFunction = function;
  30.     }
  31.  
  32.   /**
  33.    * Perform my unary function on the operand and then return the result of
  34.    * applying my predicate function object to this result.
  35.    * @param object The operand.
  36.    * @return predicate( function( object ) )
  37.    */
  38.   public boolean execute( Object object )
  39.     {
  40.     return myPredicate.execute( myFunction.execute( object ) );
  41.     }
  42.   }
  43.