Misc (API documentation of hlt.language packages)
Date: 2013-01-30

hlt.language.util

## Class Misc

- java.lang.Object
- - hlt.language.util.Misc

-     public class Misc
      extends java.lang.Object

  This class implements a few of useful methods.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Misc()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `equals(java.lang.Object o1, java.lang.Object o2)` Returns `true` iff the two specified, possibly `null`, objects are equal.
    `static int` | `hash(java.lang.String s)` Computes a hash code for the given string using a variant of the algorithm due to P.J.Weinberger described in the Dragon Book.
    `static int` | `hashCode(double x)` Returns a hash code for the specified double.
    `static int` | `hashCode(java.lang.Object object)` Returns the hashcode of the specified, possibly `null` object.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Misc

          public Misc()

  - ### Method Detail

    - #### equals

          public static final boolean equals(java.lang.Object o1,
                       java.lang.Object o2)

      Returns `true` iff the two specified, possibly `null`, objects are equal.

    - #### hashCode

          public static final int hashCode(java.lang.Object object)

      Returns the hashcode of the specified, possibly `null` object.

    - #### hashCode

          public static final int hashCode(double x)

      Returns a hash code for the specified double.

    - #### hash

          public static final int hash(java.lang.String s)

      Computes a hash code for the given string using a variant of the algorithm due to P.J.Weinberger described in the Dragon Book. The difference is that each character is weighed by a function of its position and the string's length. This has for effect to improve scatterring of identifiers differring by a suffix, which is a rather common situation in program texts (e.g.`i1, i2, i3,` ...). As always, this hash code is supposed to work best when the size of the hash table (i.e. the number to '%' this code with) is prime.