jopt.csp.util
Class LongSparseSet

java.lang.Object
  extended byjopt.csp.util.LongSet
      extended byjopt.csp.util.LongSparseSet
All Implemented Interfaces:
NumSet

public class LongSparseSet
extends LongSet

A sorted set of long values


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

Constructor Detail

LongSparseSet

public LongSparseSet()
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 LongSet

getMin

public long getMin()
Returns minimum value for set

Specified by:
getMin in class LongSet

getMax

public long getMax()
Returns maximum value for set

Specified by:
getMax in class LongSet

contains

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

Specified by:
contains in class LongSet

add

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

Specified by:
add in class LongSet

add

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

Specified by:
add in class LongSet

remove

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

Specified by:
remove in class LongSet

remove

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

Specified by:
remove in class LongSet

removeStartingFrom

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

Specified by:
removeStartingFrom in class LongSet

removeEndingAt

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

Specified by:
removeEndingAt in class LongSet

getNextHigher

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

Specified by:
getNextHigher in class LongSet

getNextLower

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

Specified by:
getNextLower in class LongSet

setListener

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


getListener

public LongSparseSetListener 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 LongSet

values

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


toString

public java.lang.String toString()