Class NARKey

java.lang.Object
com.nt.udc.nar.NARKey
All Implemented Interfaces:
Serializable

public class NARKey extends Object implements Serializable
This class implements a simple NAR key. For the most part, this class should be used when the user needs to deal with a set of NAR's, but would like to access them via a key, rather than by searching (such as in a Hashtable-type Object).
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected boolean
     
    protected byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NARKey(byte[] value)
    Use this constructor when you already have a set of bytes that qualifies as the hash code.
    NARKey(NAR nar, int[] attrs)
    Creates a NAR Key from the given NAR, using the given attributes to build the key.
    NARKey(NAR data, FieldKey[] fieldKeyAttrs)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Tests for equality among 2 NARKeys.
    int
    Returns the hash code of this NARKey.
    byte[]
    Returns the byte array value for this key.
    Converts this key to a String.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • keyvalue

      protected byte[] keyvalue
    • hash

      protected int hash
    • hash_made

      protected boolean hash_made
  • Constructor Details

    • NARKey

      public NARKey(byte[] value)
      Use this constructor when you already have a set of bytes that qualifies as the hash code.
      Parameters:
      value - Bytes, to be used as the hash code
    • NARKey

      public NARKey(NAR nar, int[] attrs) throws NullPointerException
      Creates a NAR Key from the given NAR, using the given attributes to build the key.
      Parameters:
      nar - NAR to build the key from.
      attrs - Attributes to use when building the key.
      Throws:
      NullPointerException
    • NARKey

      public NARKey(NAR data, FieldKey[] fieldKeyAttrs)
  • Method Details

    • toBytes

      public byte[] toBytes()
      Returns the byte array value for this key.
    • hashCode

      public int hashCode()
      Returns the hash code of this NARKey.
      Overrides:
      hashCode in class Object
      Returns:
      Hash code of this NARKey.
    • equals

      public boolean equals(Object o)
      Tests for equality among 2 NARKeys. Although this method allows any Object as a parameter, this method will always return false if the parameter is not a NARKey object.
      Overrides:
      equals in class Object
      Parameters:
      o - NARKey Object to compare.
      Returns:
      true, if keys are equal
    • toString

      public String toString()
      Converts this key to a String.
      Overrides:
      toString in class Object
      Returns:
      Key, in String format.