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 / UnaryNot.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  1007 b   |  39 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.  * 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 COM.objectspace.jgl.BinaryNot
  11.  * @version 2.0.2
  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.