edu.vt.marian.search
Class EnumCacheWtdObjSet

java.lang.Object
  |
  +--edu.vt.marian.search.VectorWtdObjSet
        |
        +--edu.vt.marian.search.EnumCacheWtdObjSet

public class EnumCacheWtdObjSet
extends VectorWtdObjSet
implements WtdObjSet

A Vector-based cache for any Enumeration. Given any class that implements Enumeration and returns elements in Weight order, construct the Weighted Object Set behavior on top of it.

NOTE: No checking is currently done to ensure that the base Enumeration is (a) returning unique objects or (b) returning them in non-increasing Weight order. Use this baby only very carefully.

See Also:
WtdObjSet, VectorWtdObjSet, Enumeration, EnumCacheWtdObjSetEnum

Field Summary
protected  java.util.Enumeration base
           
 
Fields inherited from class edu.vt.marian.search.VectorWtdObjSet
debug, v
 
Constructor Summary
EnumCacheWtdObjSet(java.util.Enumeration baseEnum, edu.vt.marian.common.Debug d)
           
 
Method Summary
 int approxSize()
          Return the approximate number of elements in this set (can be cheap and dirty).
 WtdObjSetEnumeration elements()
          Create an Enumeration for this set.
 int exactSize()
          Return the exact number of elements in this set (may be costly).
 edu.vt.marian.common.Weight isElt(edu.vt.marian.common.FullID id)
          Is a given ID an element of this set?
 boolean isEmpty()
          Is this set empty?
 int maxSize()
          Return the maximum number of elements in this set (can be cheap and dirty).
 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 class edu.vt.marian.search.VectorWtdObjSet
add
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

base

protected java.util.Enumeration base
Constructor Detail

EnumCacheWtdObjSet

public EnumCacheWtdObjSet(java.util.Enumeration baseEnum,
                          edu.vt.marian.common.Debug d)
Method Detail

elements

public WtdObjSetEnumeration elements()
Create an Enumeration for this set.
Specified by:
elements in interface WtdObjSet
Overrides:
elements in class VectorWtdObjSet

isEmpty

public boolean isEmpty()
Is this set empty?
Specified by:
isEmpty in interface WtdObjSet
Returns:
true / false
Overrides:
isEmpty in class VectorWtdObjSet

isElt

public edu.vt.marian.common.Weight isElt(edu.vt.marian.common.FullID id)
Is a given ID an element of this set?
Specified by:
isElt in interface WtdObjSet
Parameters:
id - The (ID of the) element to be tested.
Returns:
null -- the element is not in the set.
any valid Weight -- the element is in the set with that Weight.
Overrides:
isElt in class VectorWtdObjSet

exactSize

public int exactSize()
Return the exact number of elements in this set (may be costly).
Specified by:
exactSize in interface WtdObjSet
Overrides:
exactSize in class VectorWtdObjSet

approxSize

public int approxSize()
Return the approximate number of elements in this set (can be cheap and dirty).
Specified by:
approxSize in interface WtdObjSet
Overrides:
approxSize in class VectorWtdObjSet

maxSize

public int maxSize()
Return the maximum number of elements in this set (can be cheap and dirty).
Specified by:
maxSize in interface WtdObjSet
Overrides:
maxSize in class VectorWtdObjSet

toString

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

profile

public java.lang.String profile()
Return a short human-readable string that quickly describes this set.
Specified by:
profile in interface WtdObjSet
Overrides:
profile in class VectorWtdObjSet