index
Class DataEntry

java.lang.Object
  extended by index.DataEntry

 class DataEntry
extends java.lang.Object

Records stored in an index file; using the textbook's "Alternative 2" (see page 276) to allow for multiple indexes. Duplicate keys result in duplicate DataEntry instances.


Field Summary
 SearchKey key
          The search key (i.e.
 RID rid
          The data record (i.e.
 
Constructor Summary
DataEntry(byte[] data, short offset)
          Constructs a DataEntry stored in the given data buffer.
DataEntry(SearchKey key, RID rid)
          Constructs a DataEntry from the given values.
 
Method Summary
 boolean equals(java.lang.Object obj)
          True if obj is a DataEntry with the same values; false otherwise.
 short getLength()
          Gets the total length of the data entry (in bytes).
 void writeData(byte[] data, short offset)
          Writes the DataEntry into the given data buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

public SearchKey key
The search key (i.e. integer, float, string).


rid

public RID rid
The data record (i.e. in some heap file).

Constructor Detail

DataEntry

public DataEntry(SearchKey key,
                 RID rid)
Constructs a DataEntry from the given values.


DataEntry

public DataEntry(byte[] data,
                 short offset)
Constructs a DataEntry stored in the given data buffer.

Method Detail

writeData

public void writeData(byte[] data,
                      short offset)
Writes the DataEntry into the given data buffer.


getLength

public short getLength()
Gets the total length of the data entry (in bytes).


equals

public boolean equals(java.lang.Object obj)
True if obj is a DataEntry with the same values; false otherwise.

Overrides:
equals in class java.lang.Object