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

  1. // Copyright(c) 1996 ObjectSpace, Inc.
  2. // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
  3.  
  4. package jgl;
  5.  
  6. /**
  7.  * Hash is a unary function that returns the hash code of its operand.
  8.  * <p>
  9.  * @version 1.1
  10.  * @author ObjectSpace, Inc.
  11.  */
  12.  
  13. public class Hash implements UnaryFunction
  14.   {
  15.   /**
  16.    * Return the hash code of my operand as an Integer, or 0 if the operand is null.
  17.    * @param object The operand.
  18.    * @return The hash code of the operand, using the standard Java hashCode() method.
  19.    */
  20.   public Object execute( Object object )
  21.     {
  22.     return new Integer( object == null ? 0 : object.hashCode() );
  23.     }
  24.   }
  25.