lempinen.neatseeker.core
Class Pointer

java.lang.Object
  |
  +--lempinen.neatseeker.core.Pointer
All Implemented Interfaces:
java.io.Serializable

public class Pointer
extends java.lang.Object
implements java.io.Serializable

Represents single Target in the TargetIndex for a particular keyword.

The Pointer class contains the information related to a single keyword in a single target. This, like many other things in life, is perhaps best illustrated by an example:

Lets assume that the file /etc/killfile contains two instances of the word Microsoft (a double-kill for Unreal Tournament enthusiasts). This words are located at positions 13 and 42.

Let's also assume that when a RepositoryMaker started indexing the file, it created a Target with the index 666 for /etc/killfile.

Thus, the bucket mic.map (depending on your hashing method, of course) will contain a key-value pair for the term Microsoft. The value is a PointerList, and within that list lives a Pointer, with the ID 666 and a sequences attribute that contains the numbers 13 and 42. Simple, huh?

Version:
$Id: Pointer.java,v 1.3 2000/09/27 15:25:21 lempinen Exp $
Author:
Sami Lempinen
See Also:
Serialized Form

Field Summary
protected  long id
           
protected  java.util.Vector sequences
           
protected  float weight
           
 
Constructor Summary
Pointer()
          Creates an empty Pointer instance.
Pointer(long i)
          Creates a Pointer instance with the given ID.
 
Method Summary
 void addSequence(java.lang.Long seq)
          Adds a sequence (a word position) within the Target.
 boolean equals(java.lang.Object anotherObject)
          Compares two Pointers.
 long getID()
          Returns the ID of the Target.
 java.util.Vector getSequences()
          Returns the list of word positions within the Target.
 float getWeight()
          Returns weight of the Pointer.
private  void readObject(java.io.ObjectInputStream in)
          Reads a serialized object.
 void setID(long i)
          Sets the ID of the Target.
 void setSequences(java.util.Vector s)
          Sets the full list of word positions.
 void setWeight(float w)
          Sets the weight of the Pointer.
 java.lang.String toString()
          Returns a String representation of the Pointer.
private  void writeObject(java.io.ObjectOutputStream out)
          Writes the object in a serialized form.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

id

protected long id

sequences

protected java.util.Vector sequences

weight

protected float weight
Constructor Detail

Pointer

public Pointer()
Creates an empty Pointer instance.

Pointer

public Pointer(long i)
Creates a Pointer instance with the given ID.
Method Detail

setID

public void setID(long i)
Sets the ID of the Target.

getID

public long getID()
Returns the ID of the Target.

addSequence

public void addSequence(java.lang.Long seq)
Adds a sequence (a word position) within the Target.

getSequences

public java.util.Vector getSequences()
Returns the list of word positions within the Target.

setSequences

public void setSequences(java.util.Vector s)
Sets the full list of word positions. This functionality is for composite searches where new Pointers are created on the fly.

setWeight

public void setWeight(float w)
Sets the weight of the Pointer.

getWeight

public float getWeight()
Returns weight of the Pointer.

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes the object in a serialized form.

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads a serialized object.

equals

public boolean equals(java.lang.Object anotherObject)
Compares two Pointers.
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns a String representation of the Pointer.
Overrides:
toString in class java.lang.Object