edu.cmu.minorthird.classify
Class WeightedSet<T>

java.lang.Object
  extended by edu.cmu.minorthird.classify.WeightedSet<T>
All Implemented Interfaces:
java.io.Serializable

public class WeightedSet<T>
extends java.lang.Object
implements java.io.Serializable

Set of objects, each with an associated weight

See Also:
Serialized Form

Constructor Summary
WeightedSet()
           
 
Method Summary
 boolean add(T object, double weight)
          Add a new object.
 java.util.Set<T> asSet()
           
 boolean contains(T object)
           
 double getWeight(T object)
           
 double getWeight(T object, double defaultWeight)
          Get weight for an object.
 java.util.Iterator<T> iterator()
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeightedSet

public WeightedSet()
Method Detail

add

public boolean add(T object,
                   double weight)
Add a new object.


getWeight

public double getWeight(T object,
                        double defaultWeight)
Get weight for an object.


getWeight

public double getWeight(T object)

asSet

public java.util.Set<T> asSet()

contains

public boolean contains(T object)

iterator

public java.util.Iterator<T> iterator()

size

public int size()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object