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 / SwappedBinaryPredicate.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  997 b   |  38 lines

  1. // Copyright(c) 1997 ObjectSpace, Inc.
  2.  
  3. package COM.objectspace.jgl;
  4.  
  5. /**
  6.  * SwappedBinaryPredicate is a binary predicate that returns the result of
  7.  * applying its operands to a BinaryPredicate in the opposite order they
  8.  * were received.
  9.  * <p>
  10.  * @version 2.0.2
  11.  * @author ObjectSpace, Inc.
  12.  */
  13.  
  14. public final class SwappedBinaryPredicate implements BinaryPredicate
  15.   {
  16.   BinaryPredicate predicate;
  17.  
  18.   /**
  19.    * Construct myself with a binary predicate object.
  20.    * @param predicate The binary predicate object.
  21.    */
  22.   public SwappedBinaryPredicate( BinaryPredicate predicate )
  23.     {
  24.     this.predicate = predicate;
  25.     }
  26.  
  27.   /**
  28.    * Swap the order of operands and return the value of my contained predicate.
  29.    * @param first The first operand.
  30.    * @param second The second operand.
  31.    * @return predicate.execute( second, first )
  32.    */
  33.   public boolean execute( Object first, Object second )
  34.     {
  35.     return predicate.execute( second, first );
  36.     }
  37.   }
  38.