edu.vt.marian.search
Class ScaledWtdObjSetEnum
java.lang.Object
|
+--edu.vt.marian.search.ScaledWtdObjSetEnum
- public class ScaledWtdObjSetEnum
- extends java.lang.Object
- implements WtdObjSetEnumeration
Enumeration for a Scaled Weighted Object Set.
NOTE: We presume that the base Enumeration is creating new WtdObjs for
distribution to the outside world. Thus we only need to scale them, not
copy them. Nor do we need to copy the baseEnumeration in the constructor,
as it is ours and ours alone.
Synchronization Note: baseEnumeration should alrady be synchronizing
calls to all at-risk methods, so this does not.
- See Also:
ScaledWtdObjSet,
WtdObjSetEnumeration
|
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 |
debug
protected edu.vt.marian.common.Debug debug
baseEnum
protected WtdObjSetEnumeration baseEnum
scFactor
protected edu.vt.marian.common.Weight scFactor
ScaledWtdObjSetEnum
public ScaledWtdObjSetEnum(WtdObjSetEnumeration baseEnumeration,
edu.vt.marian.common.Weight scalingFactor,
edu.vt.marian.common.Debug d)
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.