Class StringKey

java.lang.Object
com.coyotegulch.jisp.KeyObject
com.coyotegulch.jisp.StringKey
All Implemented Interfaces:
Externalizable, Serializable

public class StringKey extends KeyObject
StringKey defines a 16-character fixed-length text key.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
     

    Fields inherited from class com.coyotegulch.jisp.KeyObject

    KEY_EQUAL, KEY_ERROR, KEY_LESS, KEY_MORE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a blank (null) StringKey.
    StringKey(String key_value)
    Creates a new StringKey using key_value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares the invoking StringKey to key, returning one of the KEY_* constants based on the relationship of the two keys.
    int
    Returns a hash code value for the object, which is, in effect, the the sum of the characters in the string key value.
    Returns a "null" (i.e., blank) StringKey, to be used as a space-holder in certain kinds of ObjectIndexes.
    void
    StringKey implements the readExternal method to restore its contents.
    Returns the String representation of a StringKey.
    void
    StringKey implements the writeExternal method to save its contents.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • StringKey

      public StringKey(String key_value)
      Creates a new StringKey using key_value.

      Parameters:
      key_value - The text of the newly-created key.
    • StringKey

      public StringKey()
      Creates a blank (null) StringKey.
  • Method Details

    • compareTo

      public int compareTo(KeyObject key)
      Compares the invoking StringKey to key, returning one of the KEY_* constants based on the relationship of the two keys.
      Specified by:
      compareTo in class KeyObject
      Parameters:
      key - The StringKey value to be compared against the invoking key.
      Returns:
      one of the KEY_* constants based on the relationship of the two keys.
    • makeNullKey

      public KeyObject makeNullKey()
      Returns a "null" (i.e., blank) StringKey, to be used as a space-holder in certain kinds of ObjectIndexes.
      Specified by:
      makeNullKey in class KeyObject
      Returns:
      a "null" (i.e., blank) StringKey constant.
      See Also:
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      StringKey implements the writeExternal method to save its contents.
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      StringKey implements the readExternal method to restore its contents.
      Throws:
      IOException
      ClassNotFoundException
    • toString

      public String toString()
      Returns the String representation of a StringKey.
      Overrides:
      toString in class KeyObject
      Returns:
      String representation of a StringKey.
    • hashCode

      public int hashCode()
      Returns a hash code value for the object, which is, in effect, the the sum of the characters in the string key value.
      Overrides:
      hashCode in class Object
      Returns:
      hash code value for this object.
      See Also: