org.egothor.util.hash
Class Bucket

java.lang.Object
  extended by org.egothor.util.hash.Bucket

public final class Bucket
extends java.lang.Object

Author:
galambos

Constructor Summary
Bucket(int bucketsize, int datasize)
           
Bucket(int bucketsize, long fromoff, DataInput from, int datasize)
           
 
Method Summary
protected  void clear()
          Clear this bucket, but do not modify dirty state.
protected  void copyFrom(Bucket b, boolean dirty)
          This bucket becomes the exact copy of the bucket passed, but the dirty flag is set as required.
 long put(byte[] data, int localoffset, long id)
          Put the new data element into the hash table.
protected  java.util.BitSet split(int sim, Bucket[] to)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bucket

public Bucket(int bucketsize,
              int datasize)
Parameters:
bucketsize - total size of the bucket
datasize - size of one datablock

Bucket

public Bucket(int bucketsize,
              long fromoff,
              DataInput from,
              int datasize)
       throws java.io.IOException
Throws:
java.io.IOException
Method Detail

put

public long put(byte[] data,
                int localoffset,
                long id)
Put the new data element into the hash table. If the item is already inhere, then its negative id value is returned (the id value when the item has come). The id is returned when the data is new in this bucket, and 0 is returned if and only if the bucket is full. The id value must not be passed with 0 value.

Parameters:
data - the data block added
localoffset - the index position; the bytes of data before this index are skipped when compared with the items of this bucket
id - the new id suggested

copyFrom

protected void copyFrom(Bucket b,
                        boolean dirty)
This bucket becomes the exact copy of the bucket passed, but the dirty flag is set as required.


clear

protected void clear()
Clear this bucket, but do not modify dirty state.


split

protected java.util.BitSet split(int sim,
                                 Bucket[] to)