|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
InformationRecord2
Class InformationRecord2 defines a simple record structure, suitable for use in testing the LookupTable class of assignment 3.
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 | |
InformationRecord2(java.lang.String name,
int age,
int id,
java.lang.String address)
Construct an InformationRecord with the given field values. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Define equals as elementwise equality. |
java.lang.Object |
getKey()
Return the id field of this as the key value. |
java.lang.Object |
getKey2()
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. |
int |
hash2(java.lang.Object key,
int tableSize)
Compute the hash index for this record by summing all of the characters of the given String key with the following formula: (37 * char[0]) + (37^2 * char[1]) + ... |
java.lang.String |
toString()
Convert this to a four-tuple of the form {name, age, id, address}. |
Field Detail |
protected java.lang.String name
protected int age
protected int id
protected java.lang.String address
Constructor Detail |
public InformationRecord2(java.lang.String name, int age, int id, java.lang.String address)
Method Detail |
public java.lang.Object getKey()
public java.lang.Object getKey2()
public int hash(java.lang.Object key, int tableSize)
public int hash2(java.lang.Object key, int tableSize)
public java.lang.String toString()
public boolean equals(java.lang.Object obj)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |