DB
Class Database

java.lang.Object
  |
  +--DB.Database

public class Database
extends java.lang.Object

Database implements a database of records


Constructor Summary
Database(int initial_size)
          Constructor Database initializes the database
 
Method Summary
 boolean delete(Key k)
          delete removes a record in the database based on a key
 Record find(Key k)
          find locates a record in the database based on a key
 boolean insert(Record r)
          insert inserts a new record into the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database

public Database(int initial_size)
Constructor Database initializes the database
Parameters:
initial_size - - the size of the database
Method Detail

find

public Record find(Key k)
find locates a record in the database based on a key
Parameters:
key - - the key of the desired record
Returns:
(the address of) the desired record; return null if record not found.

insert

public boolean insert(Record r)
insert inserts a new record into the database.
Parameters:
r - - the record
Returns:
true, if record added; return false if record not added because another record with the same key already exists in the database

delete

public boolean delete(Key k)
delete removes a record in the database based on a key
Parameters:
key - - the record's key (identification)
Returns:
true, if record is found and deleted; return false otherwise