package edu.vt.marian.search; import java.util.*; import java.io.*; import edu.vt.marian.common.*; /** The Weighted Object Set with no elements.
JDK Version : 1.1.5
@author Priyamvadha Lakshminarayanan
@author Prajakta Joshi
@see WtdObjSet
*/
public class EmptyWtdObjSet implements WtdObjSet
{
protected Debug debug; // The inevitable.
/**
The WtdObjSetEnumeration for Empty sets, where there is very
little to enumerate ;-}.
*/
public class Enum implements WtdObjSetEnumeration
{
public Enum()
{
}
/**
Skip forward a certain number of elements.
@param k How many elements to skip (if other than 0, this
surely fails for the empty set!).
@exception NoSuchElementException
*/
public void skip(int k) throws NoSuchElementException
{
if (k != 0)
throw(new NoSuchElementException());
}
public Object nextElement() throws NoSuchElementException
{
throw(new NoSuchElementException());
}
public boolean hasMoreElements()
{
return( false );
}
public int sample(int num, WtdObjBag sampleBag)
{
return( ReturnCodes.OK );
}
public int sampleToWt(Weight minWt, WtdObjBag sampleBag)
{
return( ReturnCodes.OK );
}
public int exactNumRemaining()
{
return( 0 );
}
public int approxNumRemaining()
{
return( 0 );
}
public int maxNumRemaining()
{
return( 0 );
}
} //End of (EmptyWtdObjSet) Enum
public EmptyWtdObjSet(Debug d)
{
debug = d;
}
/**
Create an Enumeration -- actually a WtdObjSetEnumeration --
for this set.
*/
public WtdObjSetEnumeration elements()
{
return( new Enum() );
}
/**
Is this set empty?
@return true / false
*/
public boolean isEmpty()
{
return( true );
}
/**
Is a given ID an element of this set?
@param id The (ID of the) element to be tested.
@return null -- the element is not in the set.
any valid Weight -- the element is in the set with that Weight.
*/
public Weight isElt(FullID id)
{
return( null );
}
/**
Return the exact number of elements in this set (may be costly).
*/
public int exactSize()
{
return(0);
}
/**
Return the approximate number of elements in this set (can be cheap
and dirty).
*/
public int approxSize()
{
return(0);
}
/**
Return the maximum number of elements in this set (can be cheap
and dirty).
*/
public int maxSize()
{
return(0);
}
/**
Return a human-readable string for this entire set (may be large).
*/
public String toString()
{
return( new String("{}") );
}
/**
Return a short human-readable string that quickly describes this set.
*/
public String profile()
{
return( new String("{}") );
}
} //End of class