Runtime

org.eclipse.gmf.runtime.common.core.util
Class HashUtil

java.lang.Object
  extended by org.eclipse.gmf.runtime.common.core.util.HashUtil

public final class HashUtil
extends java.lang.Object

A utility for generating unique hash values.


Field Summary
protected static int CONSTANT
          An arbitrary constant non-zero value.
protected static int PRIME
          An odd prime.
 
Method Summary
static int hash(boolean field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(byte field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(char field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(double field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(float field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(int field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(int base, boolean field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, byte field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, char field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, double field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, float field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, int field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, long field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(int base, java.lang.Object object)
          Retrieves a unique hash value for the specified object, based on the specified base value.
static int hash(int base, short field)
          Retrieves a unique hash value for the specified field, based on the specified base value.
static int hash(long field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
static int hash(java.lang.Object object)
          Retrieves a unique hash value for the specified object, based on a constant base value.
static int hash(short field)
          Retrieves a unique hash value for the specified field, based on a constant base value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT

protected static final int CONSTANT
An arbitrary constant non-zero value.

See Also:
Constant Field Values

PRIME

protected static final int PRIME
An odd prime.

See Also:
Constant Field Values
Method Detail

hash

public static int hash(int base,
                       boolean field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(boolean field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       byte field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(byte field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       char field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(char field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       short field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(short field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       int field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       long field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(long field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       float field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(float field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       double field)
Retrieves a unique hash value for the specified field, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(double field)
Retrieves a unique hash value for the specified field, based on a constant base value.

Parameters:
field - The field which to retrieve a hash value.
Returns:
A hash value for the specified field.

hash

public static int hash(int base,
                       java.lang.Object object)
Retrieves a unique hash value for the specified object, based on the specified base value.

Parameters:
base - The value on which to base the hash value.
object - The object for which to retrieve a hash value.
Returns:
A hash value for the specified object.

hash

public static int hash(java.lang.Object object)
Retrieves a unique hash value for the specified object, based on a constant base value.

Parameters:
object - The object for which to retrieve a hash value.
Returns:
A hash value for the specified object.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.