org.LexGrid.LexBIG.Impl.helpers
Class ScoredBitSet

java.lang.Object
  extended by java.util.BitSet
      extended by org.LexGrid.LexBIG.Impl.helpers.ScoredBitSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ScoredBitSet
extends java.util.BitSet

BitSet - extended to keep track of corresponding lucene scores.

Version:
subversion $Revision: $ checked in on $Date: $
Author:
Dan Armbrust, Jesse Erdmann
See Also:
Serialized Form

Constructor Summary
ScoredBitSet()
          Create a new ScoredBitSet object.
ScoredBitSet(int nbits)
          Create new ScoredBitSet object with an initial size of nBits.
 
Method Summary
 void and(ScoredBitSet set)
          And two bitsets together.
 void cleanUpScores()
          Remove scores which correspond to a bit which is no longer set.
 java.lang.Float getScore(int bitIndex)
          Get the score at a bitIndex.
 void mergeScores(ScoredBitSet bits)
          Sums the scores of two bit sets - use this after and'ing two bitsets together.
 void set(int bitIndex, float score)
          Set a bit to true, and record its score.
 void setScore(int bitIndex, float score)
          Set the score for a particular bit.
 
Methods inherited from class java.util.BitSet
and, andNot, cardinality, clear, clear, clear, clone, equals, flip, flip, get, get, hashCode, intersects, isEmpty, length, nextClearBit, nextSetBit, or, set, set, set, set, size, toString, xor
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScoredBitSet

public ScoredBitSet()
Create a new ScoredBitSet object.


ScoredBitSet

public ScoredBitSet(int nbits)
Create new ScoredBitSet object with an initial size of nBits.

Parameters:
nbits -
Method Detail

set

public void set(int bitIndex,
                float score)
Set a bit to true, and record its score.

Parameters:
bitIndex -
score -

getScore

public java.lang.Float getScore(int bitIndex)
Get the score at a bitIndex. Returns null if no score present.

Parameters:
bitIndex -
Returns:

setScore

public void setScore(int bitIndex,
                     float score)
Set the score for a particular bit.

Parameters:
bitIndex -
score -

cleanUpScores

public void cleanUpScores()
Remove scores which correspond to a bit which is no longer set. Useful after and'ing sets together.


mergeScores

public void mergeScores(ScoredBitSet bits)
Sums the scores of two bit sets - use this after and'ing two bitsets together. Also runs a clean up afterwords.

Parameters:
bits -

and

public void and(ScoredBitSet set)
And two bitsets together.


Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.