edu.vt.marian.search
Class EnumCacheWtdObjSetEnum

java.lang.Object
  |
  +--edu.vt.marian.search.EnumCacheWtdObjSetEnum

public class EnumCacheWtdObjSetEnum
extends java.lang.Object
implements WtdObjSetEnumeration

An Enumeration over an Enumeration -- to be precise, one of many possible Weighted Object Set Enumerations that share a single underlying simple Enumeration.

JDK Version : 1.1.5

See Also:
WtdObjSetEnumeration, WtdObjSet, EnumCacheWtdObjSet

Field Summary
protected  java.util.Vector basis
           
protected  edu.vt.marian.common.Debug debug
           
protected  java.util.Enumeration ext
           
protected  int nextElt
           
 
Constructor Summary
EnumCacheWtdObjSetEnum(java.util.Vector v, java.util.Enumeration extension, edu.vt.marian.common.Debug d)
           
 
Method Summary
 int approxNumRemaining()
          Return approximate number of elements left.
 int exactNumRemaining()
          Return exact number of elements remaining in the parent set.
 boolean hasMoreElements()
           
 int maxNumRemaining()
          Return maximum number of elements left.
 java.lang.Object nextElement()
           
 int sample(int num, WtdObjBag sampleBag)
          Copy a certain number of elements into a bag.
 int sampleToWt(edu.vt.marian.common.Weight minWt, WtdObjBag sampleBag)
          Copy into a bag all the members of this set with weights >= some weight.
 void skip(int k)
          Skip forward a certain number of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected edu.vt.marian.common.Debug debug

basis

protected java.util.Vector basis

ext

protected java.util.Enumeration ext

nextElt

protected int nextElt
Constructor Detail

EnumCacheWtdObjSetEnum

public EnumCacheWtdObjSetEnum(java.util.Vector v,
                              java.util.Enumeration extension,
                              edu.vt.marian.common.Debug d)
Method Detail

nextElement

public java.lang.Object nextElement()
                             throws java.util.NoSuchElementException

hasMoreElements

public boolean hasMoreElements()

skip

public void skip(int k)
Skip forward a certain number of elements.
Specified by:
skip in interface WtdObjSetEnumeration
Parameters:
k - How many elements to skip.
Throws:
java.util.NoSuchElementException -  

sample

public int sample(int num,
                  WtdObjBag sampleBag)
Copy a certain number of elements into a bag.
Specified by:
sample in interface WtdObjSetEnumeration
Parameters:
num - How many elements to copy.
sampleBag - The WtdObjBag to add elements to.
Returns:
OK There were Num elements left, and they all were copied well.
anything else Problems.
Throws:
java.util.NoSuchElementException -  

sampleToWt

public int sampleToWt(edu.vt.marian.common.Weight minWt,
                      WtdObjBag sampleBag)
Copy into a bag all the members of this set with weights >= some weight.
Specified by:
sampleToWt in interface WtdObjSetEnumeration
Parameters:
minWt - The lowest weight to copy.
sampleBag - The WtdObjBag to add elements to.
Returns:
OK There were Num elements left, and they all were copied well.
anything else Problems.
Throws:
java.util.NoSuchElementException -  

exactNumRemaining

public int exactNumRemaining()
Return exact number of elements remaining in the parent set.
Specified by:
exactNumRemaining in interface WtdObjSetEnumeration
Returns:
The exact number of elements still to be enumerated.

approxNumRemaining

public int approxNumRemaining()
Return approximate number of elements left.
Specified by:
approxNumRemaining in interface WtdObjSetEnumeration
Returns:
The approximate number of elements still to be enumerated.

maxNumRemaining

public int maxNumRemaining()
Return maximum number of elements left.
Specified by:
maxNumRemaining in interface WtdObjSetEnumeration
Returns:
The maximum number of elements still to be enumerated.