Class InformationRecord

java.lang.Object
  |
  +--InformationRecord
All Implemented Interfaces:
HashTableEntry

public class InformationRecord
extends java.lang.Object
implements HashTableEntry

Class InformationRecord defines a simple record structure used with the HashTable and HashTableTest examples.


Field Summary
protected  java.lang.String address
          Street address
protected  int age
          Age
protected  int id
          Unique 9-digit id
protected  java.lang.String name
          Person name
 
Constructor Summary
InformationRecord(java.lang.String name, int age, int id, java.lang.String address)
          Construct an InformationRecord with the given field values.
 
Method Summary
 java.lang.Object getKey()
          Return the id field of this as the key value.
 int hash(java.lang.Object key, int tableSize)
          Compute the hash index for this record as the given key modulo the given table size.
 java.lang.String toString()
          Convert this to a four-tuple of the form {name, age, id, address}.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Person name

age

protected int age
Age

id

protected int id
Unique 9-digit id

address

protected java.lang.String address
Street address
Constructor Detail

InformationRecord

public InformationRecord(java.lang.String name,
                         int age,
                         int id,
                         java.lang.String address)
Construct an InformationRecord with the given field values.
Method Detail

getKey

public java.lang.Object getKey()
Return the id field of this as the key value.
Specified by:
getKey in interface HashTableEntry

hash

public int hash(java.lang.Object key,
                int tableSize)
Compute the hash index for this record as the given key modulo the given table size. The given key is assumed to be an Integer id.
Specified by:
hash in interface HashTableEntry

toString

public java.lang.String toString()
Convert this to a four-tuple of the form {name, age, id, address}.
Overrides:
toString in class java.lang.Object