jopt.csp.util
Class IntSparseSet

java.lang.Object
  extended byjopt.csp.util.IntSet
      extended byjopt.csp.util.IntSparseSet
All Implemented Interfaces:
NumSet

public class IntSparseSet
extends IntSet

A sorted set of integer values


Constructor Summary
IntSparseSet()
          Creates a new set
 
Method Summary
 void add(int val)
          Adds a value to set
 void add(int start, int end)
          Adds a range of values to set
 void clear()
          Removes all values from the set
 java.lang.Object clone()
          Creates a duplicate of this set
 boolean contains(int val)
          Returns true if value is contained in set
 IntSparseSetListener getListener()
          Returns listener that is currently assigned to set
 int getMax()
          Returns maximum value for set
 int getMin()
          Returns minimum value for set
 int getNextHigher(int val)
          Returns the next higher value in the domain or current value if none exists
 int getNextLower(int val)
          Returns the next lower value in the domain or current value if none exists
 void remove(int val)
          Removes a value from the set
 void remove(int start, int end)
          Removes a range of values from the set
 void removeEndingAt(int val)
          Removes all values below and including given value
 void removeStartingFrom(int val)
          Removes all values above and including given value
 void setListener(IntSparseSetListener 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.IntSet
addAll, removeAll, removeEndingBefore, removeStartingAfter, retainAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntSparseSet

public IntSparseSet()
Creates a new set

Method Detail

size

public 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 IntSet

getMin

public int getMin()
Returns minimum value for set

Specified by:
getMin in class IntSet

getMax

public int getMax()
Returns maximum value for set

Specified by:
getMax in class IntSet

contains

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

Specified by:
contains in class IntSet

add

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

Specified by:
add in class IntSet

add

public void add(int start,
                int end)
Adds a range of values to set

Specified by:
add in class IntSet

remove

public void remove(int val)
Removes a value from the set

Specified by:
remove in class IntSet

remove

public void remove(int start,
                   int end)
Removes a range of values from the set

Specified by:
remove in class IntSet

removeStartingFrom

public void removeStartingFrom(int val)
Removes all values above and including given value

Specified by:
removeStartingFrom in class IntSet

removeEndingAt

public void removeEndingAt(int val)
Removes all values below and including given value

Specified by:
removeEndingAt in class IntSet

getNextHigher

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

Specified by:
getNextHigher in class IntSet

getNextLower

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

Specified by:
getNextLower in class IntSet

setListener

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


getListener

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


clone

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

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

values

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


toString

public java.lang.String toString()