anl.aida.core
Class STCBuilder.STCollection

java.lang.Object
  extended by anl.aida.core.STCBuilder.STCollection
All Implemented Interfaces:
ScoredTermsCollection, java.lang.Iterable<MIFSDocument>
Enclosing class:
STCBuilder

private static class STCBuilder.STCollection
extends java.lang.Object
implements ScoredTermsCollection


Nested Class Summary
(package private)  class STCBuilder.STCollection.SDCProcedure
           
(package private)  class STCBuilder.STCollection.STCProcedure
           
 
Field Summary
private  DateRange dateRange
           
private  cern.colt.map.OpenIntObjectHashMap docs
           
private  STCBuilder.TermImpl[] terms
           
 
Constructor Summary
private STCBuilder.STCollection()
           
 
Method Summary
 java.lang.Iterable<MIFSDocument> documents()
          Gets an iterable over all the documents in this collection.
 MIFSDocument getDocument(int index)
          Gets the document at the specified index.
 int getDocumentCount()
          Gets the number of documents in the collection.
 IntIterator getDocumentsFor(int termIndex)
          Gets an iterator of document indices of docs that contain a Term with the specified index.
 int getFrequency(int docIndex, int termIndex)
          Gets the frequency of the specified term in the specified document.
 DateRange getRange()
          Gets the date range (inclusive) covered by this ScoredTermsCollection.
 float getScore(int docIndex, int termIndex)
          Gets the score of the specified term in the specified document.
 MIFSTerm getTerm(int index)
          Gets the term at the specified index.
 int getTermCount()
          Gets the number of terms in the collection.
 int getTermIndex(java.lang.String term)
          Gets the index for the specified term.
 void iterateByDocument(ScoredDocumentCallback callback)
          Iterates through the collection in document order calling the relevant methods in the callback.
 void iterateByTerm(ScoredTermCallback callback)
          Iterates through the collection in term order calling the relevant methods in the callback.
 java.util.Iterator<MIFSDocument> iterator()
          Returns an iterator over a set of elements of type T.
 java.lang.Iterable<MIFSTerm> terms()
          Gets an iterable over all the terms in this collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

terms

private STCBuilder.TermImpl[] terms

docs

private cern.colt.map.OpenIntObjectHashMap docs

dateRange

private DateRange dateRange
Constructor Detail

STCBuilder.STCollection

private STCBuilder.STCollection()
Method Detail

terms

public java.lang.Iterable<MIFSTerm> terms()
Gets an iterable over all the terms in this collection.

Specified by:
terms in interface ScoredTermsCollection
Returns:
an iterable over all the terms in this collection.

iterator

public java.util.Iterator<MIFSDocument> iterator()
Returns an iterator over a set of elements of type T.

Specified by:
iterator in interface java.lang.Iterable<MIFSDocument>
Returns:
an Iterator.

documents

public java.lang.Iterable<MIFSDocument> documents()
Gets an iterable over all the documents in this collection.

Specified by:
documents in interface ScoredTermsCollection
Returns:
an iterable over all the documents in this collection.

getTermCount

public int getTermCount()
Gets the number of terms in the collection.

Specified by:
getTermCount in interface ScoredTermsCollection
Returns:
the number of terms in the collection.

getTerm

public MIFSTerm getTerm(int index)
Gets the term at the specified index.

Specified by:
getTerm in interface ScoredTermsCollection
Parameters:
index - the index of the term
Returns:
the term at the specified index.

getTermIndex

public int getTermIndex(java.lang.String term)
Gets the index for the specified term.

Specified by:
getTermIndex in interface ScoredTermsCollection
Parameters:
term - the term to get the index for
Returns:
the index for the specified term, or -1 if the term is not found.

getDocumentCount

public int getDocumentCount()
Gets the number of documents in the collection.

Specified by:
getDocumentCount in interface ScoredTermsCollection
Returns:
the number of documents in the collection.

getDocument

public MIFSDocument getDocument(int index)
Gets the document at the specified index.

Specified by:
getDocument in interface ScoredTermsCollection
Parameters:
index - the index of the document
Returns:
Gets the document at the specified index.

getFrequency

public int getFrequency(int docIndex,
                        int termIndex)
Gets the frequency of the specified term in the specified document.

Specified by:
getFrequency in interface ScoredTermsCollection
Parameters:
docIndex - the index of the document
termIndex - the index of the term
Returns:
the frequency of the specified term in the specified document.

getScore

public float getScore(int docIndex,
                      int termIndex)
Gets the score of the specified term in the specified document.

Specified by:
getScore in interface ScoredTermsCollection
Parameters:
docIndex - the index of the document
termIndex - the index of the term
Returns:
the score of the specified term in the specified document.

getDocumentsFor

public IntIterator getDocumentsFor(int termIndex)
Gets an iterator of document indices of docs that contain a Term with the specified index.

Specified by:
getDocumentsFor in interface ScoredTermsCollection
Parameters:
termIndex - the term index
Returns:
n iterator of document indices of docs that contain a Term with the specified index.

getRange

public DateRange getRange()
Gets the date range (inclusive) covered by this ScoredTermsCollection.

Specified by:
getRange in interface ScoredTermsCollection
Returns:
the date range (inclusive) covered by this ScoredTermsCollection.

iterateByDocument

public void iterateByDocument(ScoredDocumentCallback callback)
Iterates through the collection in document order calling the relevant methods in the callback. In document order, each document is processed in order such that all the term scores for that document are passed to the callback before proceeding to the next document.

Specified by:
iterateByDocument in interface ScoredTermsCollection
Parameters:
callback - methods are called on this obj during iteration

iterateByTerm

public void iterateByTerm(ScoredTermCallback callback)
                   throws AIDAException
Iterates through the collection in term order calling the relevant methods in the callback. In term order, all the scores for all the documents for a specific term are passed to the callback before starting the next term.

Specified by:
iterateByTerm in interface ScoredTermsCollection
Parameters:
callback - methods are called on this obj during iteration
Throws:
AIDAException - if there is during the callback.