com.rapidminer.tools.container
Class ValueSet

java.lang.Object
  extended by com.rapidminer.tools.container.ValueSet
All Implemented Interfaces:
java.lang.Iterable<java.lang.Double>

public class ValueSet
extends java.lang.Object
implements java.lang.Iterable<java.lang.Double>

This class represents a set of (weighted) double values. Might be e.g. used to obtain all distinct values or to efficiently store a large number of values out of a relatively small domain.

Author:
Tobias Malbrecht

Constructor Summary
ValueSet()
           
 
Method Summary
 void add(double value)
          Add a value to the set.
 void add(double value, double weight)
          Add a value with a weight to the set.
 boolean contains(double value)
          Returns whether the set contains the given value.
 double getMode()
          Returns the most common of the values in the set.
 java.util.Iterator<java.lang.Double> iterator()
          Returns an iterator over the values.
 int size()
          Returns the number of values in the set.
 java.util.Iterator<java.util.Map.Entry<java.lang.Double,java.lang.Double>> weightedValuesIterator()
          Returns an iterator over entries each consisting of a value and its weight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueSet

public ValueSet()
Method Detail

add

public void add(double value,
                double weight)
Add a value with a weight to the set.


add

public void add(double value)
Add a value to the set.


contains

public boolean contains(double value)
Returns whether the set contains the given value.


iterator

public java.util.Iterator<java.lang.Double> iterator()
Returns an iterator over the values.

Specified by:
iterator in interface java.lang.Iterable<java.lang.Double>

weightedValuesIterator

public java.util.Iterator<java.util.Map.Entry<java.lang.Double,java.lang.Double>> weightedValuesIterator()
Returns an iterator over entries each consisting of a value and its weight.


size

public int size()
Returns the number of values in the set.


getMode

public double getMode()
Returns the most common of the values in the set.



Copyright © 2001-2009 by Rapid-I