lempinen.neatseeker.core
Class Bucket

java.lang.Object
  |
  +--lempinen.neatseeker.core.Bucket

public class Bucket
extends java.lang.Object

Class that represents a single Bucket (a TreeMap). The TreeMaps contained within the Buckets are the heart and soul of NeatSeeker. They contain a set of Pointer objects indexed according to the individual keywords.

An example: suppose that the file /etc/killfile contains the string Microsoft. During indexing, the Repository is asked to add this keyword to the index. The Repository determines that Microsoft belongs to the Bucket stored in the file mic.map in the repository root directory. The Repository loads this Bucket from disk (or creates a new one), and asks the Bucket to add a Pointer object for /etc/killfile into the index with the keyword Microsoft. Simple.

The requests for adding index entries are encapsulated in Entry objects. These objects are not stored in the index -- they are merely used for passing messages.

Version:
$Id: Bucket.java,v 1.1 2000/09/23 11:21:23 lempinen Exp $
Author:
Sami Lempinen
See Also:
Repository, Pointer

Field Summary
private  java.util.TreeMap map
          The TreeMap to hold the keyword index.
private  java.lang.String mapfile
          The path where to store the serialized TreeMap object.
 
Constructor Summary
Bucket(java.lang.String file)
          Constructs a new Bucket, with the map file in file.
 
Method Summary
 void add(Entry entry)
          Adds a specific key-value pair into the map.
 void load()
          Reads the TreeMap object from a serialized file.
 void save()
          Writes the TreeMap object in a file
 PointerList search(java.lang.String key)
          Searches for a specific key in the index.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

map

private java.util.TreeMap map
The TreeMap to hold the keyword index.

mapfile

private java.lang.String mapfile
The path where to store the serialized TreeMap object.
Constructor Detail

Bucket

public Bucket(java.lang.String file)
Constructs a new Bucket, with the map file in file.
Method Detail

load

public void load()
          throws java.io.FileNotFoundException,
                 java.io.StreamCorruptedException,
                 java.io.IOException,
                 java.lang.ClassNotFoundException
Reads the TreeMap object from a serialized file.

save

public void save()
          throws java.io.FileNotFoundException,
                 java.io.IOException
Writes the TreeMap object in a file

search

public PointerList search(java.lang.String key)
Searches for a specific key in the index. Returns a PointerList containing all matching Pointers.

add

public void add(Entry entry)
Adds a specific key-value pair into the map. The necessary data for the index entry is carried over in an Entry object.