org.apache.lucene.util
Class LongSet

Object
  extended by LongSet

public class LongSet
extends Object

A fast, expandible set of positive numeric values, stored as a hash. Doesn't support deletion, and isn't very good at handling sequential values, so beware.

Author:
Martin Haye

Field Summary
private  int curSize
           
private  long[] ents
           
private  int hashSize
           
 
Constructor Summary
LongSet(int maxSize)
          Create the hash table that can comfortably hold the specified number of entries.
 
Method Summary
 void add(long val)
          Add a value to the set, if it's not already present.
 boolean contains(long val)
          Check if the given value is contained in the set.
private  void grow()
          Expand the table and re-hash the existing entries.
 int size()
          Tells how many entries are currently in the set
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashSize

private int hashSize

ents

private long[] ents

curSize

private int curSize
Constructor Detail

LongSet

public LongSet(int maxSize)
Create the hash table that can comfortably hold the specified number of entries. The actual table is created to be the smallest prime greater than size*2.

Parameters:
maxSize - Max # of entries
Method Detail

add

public void add(long val)
Add a value to the set, if it's not already present.


contains

public boolean contains(long val)
Check if the given value is contained in the set.


grow

private void grow()
Expand the table and re-hash the existing entries.


size

public int size()
Tells how many entries are currently in the set