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 / BindSecond.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  1.3 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.  * BindSecond is a unary function object that allows you to apply a binary function to
  8.  * an operand and a predefined value. The reason that it's called BindSecond is that the
  9.  * predefined value is always used as the 2nd parameter to the binary function.
  10.  * <p>
  11.  * @see COM.objectspace.jgl.BindFirst
  12.  * @version 2.0.2
  13.  * @author ObjectSpace, Inc.
  14.  */
  15.  
  16. public final class BindSecond implements UnaryFunction
  17.   {
  18.   BinaryFunction myFunction;
  19.   Object myObject;
  20.  
  21.   /**
  22.    * Construct myself with a binary function object and a predefined value.
  23.    * @param function The binary function object.
  24.    * @param value The object to use as the 2nd parameter.
  25.    */
  26.   public BindSecond( BinaryFunction function, Object value )
  27.     {
  28.     myFunction = function;
  29.     myObject = value;
  30.     }
  31.  
  32.   /**
  33.    * Perform my binary function on the operand using the operand as the 1st parameter
  34.    * and the predefined value as the 2nd parameter.
  35.    * @param object The operand.
  36.    * @return function( value, object )
  37.    */
  38.   public Object execute( Object object )
  39.     {
  40.     return myFunction.execute( object, myObject );
  41.     }
  42.   }
  43.