anl.aida.util
Class HighestTermScores

java.lang.Object
  extended by anl.aida.util.HighestTermScores

public class HighestTermScores
extends java.lang.Object

Container that can be used to gather X number of terms with the highest scores.


Field Summary
private  int limit
           
private  float minScore
           
private  java.lang.String minTerm
           
private  java.util.Map<java.lang.String,java.lang.Float> vals
           
 
Constructor Summary
HighestTermScores(int size)
          Creates a HighestTermScores of specified size.
 
Method Summary
 boolean add(java.lang.String term, float score)
          Adds the specified term and score to this HighestTermScores.
 int size()
          Gets the true size of this HighestTermScores.
 java.lang.Iterable<TermScore> termScores()
          Gets an iterable over the term scores in this HighestTermScores.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vals

private java.util.Map<java.lang.String,java.lang.Float> vals

limit

private int limit

minScore

private float minScore

minTerm

private java.lang.String minTerm
Constructor Detail

HighestTermScores

public HighestTermScores(int size)
Creates a HighestTermScores of specified size. The number of ranked terms will be <= to this size.

Parameters:
size - the size of the HighestTermScores collection.
Method Detail

size

public int size()
Gets the true size of this HighestTermScores.

Returns:
the true size of this HighestTermScores.

add

public boolean add(java.lang.String term,
                   float score)
Adds the specified term and score to this HighestTermScores. If the term and score are added, the returns to true, otherwise false. A term will not be added if this HighestTermScores is at its size limit and the score is less than or equal to the currently stored terms.

Parameters:
term - the term to add
score - the score of the term to add
Returns:
true if the term is added, otherwise false.

termScores

public java.lang.Iterable<TermScore> termScores()
Gets an iterable over the term scores in this HighestTermScores. The order of the iteration is from lowest to highest.

Returns:
an iterable over the term scores in this HighestTermScores.