edu.vt.marian.search
Class SingletonWtdObjSet

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

public class SingletonWtdObjSet
extends java.lang.Object
implements WtdObjSet

A Weighted Object Set with only one element.

JDK Version : 1.1.5

See Also:
WtdObjSet, WtdObj, SingletonWtdObjSetEnum

Field Summary
protected  edu.vt.marian.common.Debug debug
           
protected  edu.vt.marian.common.WtdObj onlyElt
          The single element in this set.
 
Constructor Summary
SingletonWtdObjSet(edu.vt.marian.common.FullID id, edu.vt.marian.common.Weight wt, edu.vt.marian.common.Debug d)
          Construct a singleton set from a single id and a weight.
SingletonWtdObjSet(int clID, int instID, edu.vt.marian.common.Weight wt, edu.vt.marian.common.Debug d)
          Construct a singleton set from details.
SingletonWtdObjSet(edu.vt.marian.common.WtdObj w, edu.vt.marian.common.Debug d)
          Construct a singleton set from a single object.
 
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 isElt(edu.vt.marian.common.FullID id, edu.vt.marian.common.Weight wt)
          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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

protected edu.vt.marian.common.Debug debug

onlyElt

protected edu.vt.marian.common.WtdObj onlyElt
The single element in this set.
Constructor Detail

SingletonWtdObjSet

public SingletonWtdObjSet(edu.vt.marian.common.WtdObj w,
                          edu.vt.marian.common.Debug d)
Construct a singleton set from a single object.
Parameters:
w - wtdObj
d - Debug

SingletonWtdObjSet

public SingletonWtdObjSet(edu.vt.marian.common.FullID id,
                          edu.vt.marian.common.Weight wt,
                          edu.vt.marian.common.Debug d)
Construct a singleton set from a single id and a weight.
Parameters:
FullID - ID of the only element.
wt - Weight for the element.
d - Debug

SingletonWtdObjSet

public SingletonWtdObjSet(int clID,
                          int instID,
                          edu.vt.marian.common.Weight wt,
                          edu.vt.marian.common.Debug d)
Construct a singleton set from details.
Parameters:
clID - Class Id
instID - Instance ID
wt - Weight
Method Detail

elements

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

isElt

public boolean isElt(edu.vt.marian.common.FullID id,
                     edu.vt.marian.common.Weight wt)
Is a given ID an Element of this set?
Parameters:
id - The (ID of the) element to be tested.
Wt - Set to the Weight of id in this set if id is an element.
Returns:
true / false

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.

isEmpty

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

exactSize

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

approxSize

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

maxSize

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

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 java.lang.Object

profile

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