home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-09-10 | 1.1 KB | 42 lines |
- // Copyright(c) 1996 ObjectSpace, Inc.
- // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
-
- package jgl;
-
- /**
- * UnaryCompose is a unary function object that returns the result of executing
- * two operations in a specific sequence.
- * <p>
- * @see jgl.BinaryCompose
- * @version 1.1
- * @author ObjectSpace, Inc.
- */
-
- public final class UnaryCompose implements UnaryFunction
- {
- UnaryFunction myFunction1;
- UnaryFunction myFunction2;
-
- /**
- * Construct myself with two unary function objects.
- * @param function1 The first unary function object.
- * @param function2 The second unary function object.
- */
- public UnaryCompose( UnaryFunction function1, UnaryFunction function2 )
- {
- myFunction1 = function1;
- myFunction2 = function2;
- }
-
- /**
- * Perform my second unary function on the operand and then return the result of applying
- * my first unary function object to this result.
- * @param object The operand.
- * @return function1( function2( object ) )
- */
- public Object execute( Object object )
- {
- return myFunction1.execute( myFunction2.execute( object ) );
- }
- }
-