edu.vt.marian.search
Interface Sequencer

All Known Subinterfaces:
SetCollectionSequencer, WtdObjSetSequencer

public abstract interface Sequencer
extends java.util.Enumeration

Sequencers are an important component of Searchers. The function of a Sequencer is to take several WtdObjSets and merge them into a single bag of weighted objects in non-increasing order. The contents of this resulting sequence are the WtdObjs from the component sets in the same order as a WtdObjSet (highest weight to lowest) but with duplicates not removed.

NOTE: Given the intended use of Sequencers, we can implement the result sequence as a succession of objects returned by a nextElement() method. There are two ways to design this. Either a Sequencer should return an Enumeration that provides nextElement() and hasMoreElements() methods, or it can itself *be* an Enumeration. I have chosen the second course here, since most sequencers only run through their sequence a single time (while loading the appropriate Table or Cache). The expection is the "terminal" sequencers in Aquinas and Occam, where many objects may share a single Searcher, each using their own Enumeration to step through a (partially pre-computed) sequence of results. To enable this sharing, we will capture the Sequencer results in a Cache and provide Enumerations to the Cache.

See Also:
Enumeration, EnumCacheWtdObjSet, EnumCacheWtdObjSetEnum

Method Summary
 int expectedNumElts()
          Return the expected number of unique elements in the result sequence.
 int maxNumElts()
          Return the maximum number of unique elements in the result sequence.
 java.lang.String profile()
          Return a short human-readable string that quickly describes this set.
 java.lang.String toString()
          Return a human-readable string for this entire set (may be large).
 
Methods inherited from interface java.util.Enumeration
hasMoreElements, nextElement
 

Method Detail

expectedNumElts

public int expectedNumElts()
Return the expected number of unique elements in the result sequence.

NOTE: The statistics here are drawn from the hypergeometric distribution. Follow code and documentation in the C++ file "search/woset_coll.cc."

To make the statistics work, we need to know the size of the universe: in this case, the class from which the objects in the sets were drawn. Since this is most likely to be known at construction time, any constructor for a Sequencer should include a parameter
    long classSize.


maxNumElts

public int maxNumElts()
Return the maximum number of unique elements in the result sequence. (This is usually just the sum of all the elements in each component set.)

toString

public java.lang.String toString()
Return a human-readable string for this entire set (may be large).
Overrides:
toString in class java.lang.Object

profile

public java.lang.String profile()
Return a short human-readable string that quickly describes this set.