home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / jgl_1_1 / src / binarynot.java < prev    next >
Encoding:
Java Source  |  1996-09-10  |  1023 b   |  40 lines

  1. // Copyright(c) 1996 ObjectSpace, Inc.
  2. // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
  3.  
  4. package jgl;
  5.  
  6. /**
  7.  * BinaryNot is a binary predicate that returns true if the result of executing
  8.  * a binary predicate on its operands is false.
  9.  * <p>
  10.  * @see jgl.UnaryNot
  11.  * @version 1.1
  12.  * @author ObjectSpace, Inc.
  13.  */
  14.  
  15. public final class BinaryNot implements BinaryPredicate
  16.   {
  17.   BinaryPredicate myPredicate;
  18.  
  19.   /**
  20.    * Construct myself with a single binary predicate object.
  21.    * @param predicate The binary predicate object.
  22.    */
  23.   public BinaryNot( BinaryPredicate predicate )
  24.     {
  25.     myPredicate = predicate;
  26.     }
  27.  
  28.   /**
  29.    * Perform my binary predicate on the operands and return true if the predicate 
  30.    * returns false.
  31.    * @param first The first operand.
  32.    * @param second The second operand.
  33.    * @return !function( first, second )
  34.    */
  35.   public boolean execute( Object first, Object second )
  36.     {
  37.     return !myPredicate.execute( first, second );
  38.     }
  39.   }
  40.