jopt.csp.util
Class DoubleSparseSet

java.lang.Object
  extended byjopt.csp.util.DoubleSet
      extended byjopt.csp.util.DoubleSparseSet
All Implemented Interfaces:
NumSet

public class DoubleSparseSet
extends DoubleSet

A sorted set of individual double values


Constructor Summary
DoubleSparseSet()
          Creates a new set
 
Method Summary
 void add(double val)
          Adds a value to set
 void add(double start, double end)
          Inherited method that doesn't make sense with a sparse set.
 void clear()
          Removes all values from the set
 java.lang.Object clone()
          Creates a duplicate of this set
 boolean contains(double val)
          Returns true if value is contained in set
 DoubleSparseSetListener getListener()
          Returns listener that is currently assigned to set
 double getMax()
          Returns maximum value for set
 double getMin()
          Returns minimum value for set
 double getNextHigher(double val)
          Returns the next higher value in the domain or current value if none exists
 double getNextLower(double val)
          Returns the next lower value in the domain or current value if none exists
 void remove(double val)
          Removes a value from the set
 void remove(double start, double end)
          Removes a range of values from the set
 void removeEndingAt(double val)
          Removes all values below and including given value
 void removeEndingBefore(double val)
          Removes all values below given value
 void removeStartingAfter(double val)
          Removes all values above given value
 void removeStartingFrom(double val)
          Removes all values above and including given value
 void setListener(DoubleSparseSetListener listener, int callback)
          Sets listener for set to be notified of changes
 int size()
          Returns the size of the set
 java.lang.String toString()
           
 NumberIterator values()
          returns an iterator containing all numbers in the set
 
Methods inherited from class jopt.csp.util.DoubleSet
addAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleSparseSet

public DoubleSparseSet()
Creates a new set

Method Detail

size

public final int size()
Returns the size of the set


clear

public void clear()
Removes all values from the set

Specified by:
clear in interface NumSet
Specified by:
clear in class DoubleSet

getMin

public double getMin()
Returns minimum value for set

Specified by:
getMin in class DoubleSet

getMax

public double getMax()
Returns maximum value for set

Specified by:
getMax in class DoubleSet

contains

public boolean contains(double val)
Returns true if value is contained in set

Specified by:
contains in class DoubleSet

add

public void add(double val)
Adds a value to set

Specified by:
add in class DoubleSet

add

public void add(double start,
                double end)
Inherited method that doesn't make sense with a sparse set. You cannot add a range of values to sparse set. This will throw an exception if called.

Specified by:
add in class DoubleSet

remove

public void remove(double val)
Description copied from class: DoubleSet
Removes a value from the set

Specified by:
remove in class DoubleSet

remove

public void remove(double start,
                   double end)
Description copied from class: DoubleSet
Removes a range of values from the set

Specified by:
remove in class DoubleSet

removeStartingFrom

public void removeStartingFrom(double val)
Description copied from class: DoubleSet
Removes all values above and including given value

Specified by:
removeStartingFrom in class DoubleSet

removeStartingAfter

public void removeStartingAfter(double val)
Description copied from class: DoubleSet
Removes all values above given value

Specified by:
removeStartingAfter in class DoubleSet

removeEndingAt

public void removeEndingAt(double val)
Description copied from class: DoubleSet
Removes all values below and including given value

Specified by:
removeEndingAt in class DoubleSet

removeEndingBefore

public void removeEndingBefore(double val)
Description copied from class: DoubleSet
Removes all values below given value

Specified by:
removeEndingBefore in class DoubleSet

getNextHigher

public double getNextHigher(double val)
Returns the next higher value in the domain or current value if none exists

Specified by:
getNextHigher in class DoubleSet

getNextLower

public double getNextLower(double val)
Returns the next lower value in the domain or current value if none exists

Specified by:
getNextLower in class DoubleSet

clone

public java.lang.Object clone()
Creates a duplicate of this set

Specified by:
clone in interface NumSet
Specified by:
clone in class DoubleSet

setListener

public void setListener(DoubleSparseSetListener listener,
                        int callback)
Sets listener for set to be notified of changes


getListener

public DoubleSparseSetListener getListener()
Returns listener that is currently assigned to set


values

public NumberIterator values()
returns an iterator containing all numbers in the set


toString

public java.lang.String toString()