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

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