// Copyright(c) 1996,1997 ObjectSpace, Inc.
// Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.

package COM.objectspace.jgl;

/**
 * Hash is a unary function that returns the hash code of its operand.
 * <p>
 * @version 2.0.2
 * @author ObjectSpace, Inc.
 */

public class Hash implements UnaryFunction
  {
  /**
   * Return the hash code of my operand as an Integer, or 0 if the operand is null.
   * @param object The operand.
   * @return The hash code of the operand, using the standard Java hashCode() method.
   */
  public Object execute( Object object )
    {
    return new Integer( object == null ? 0 : object.hashCode() );
    }
  }
