edu.emory.mathcs.util.collections.longs
Class AbstractLongInterval.ComplementView

java.lang.Object
  extended byedu.emory.mathcs.util.collections.longs.AbstractLongCollection
      extended byedu.emory.mathcs.util.collections.longs.AbstractLongSet
          extended byedu.emory.mathcs.util.collections.longs.AbstractLongSortedSet
              extended byedu.emory.mathcs.util.collections.longs.AbstractLongInterval.ComplementView
All Implemented Interfaces:
LongCollection, LongSet, LongSortedSet
Enclosing class:
AbstractLongInterval

protected static class AbstractLongInterval.ComplementView
extends AbstractLongSortedSet


Nested Class Summary
 
Nested classes inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongSortedSet
AbstractLongSortedSet.AbstractComplementSubView, AbstractLongSortedSet.AbstractSubView, AbstractLongSortedSet.ForwardIntervalItemIterator, AbstractLongSortedSet.ReverseIntervalItemIterator
 
Method Summary
 LongInterval ceilingInterval(long n)
          Returns the smallest (left-most), widest interval contained in this set which elements are not all smaller than the specified number.
 LongSet complementSet()
          Returns a complement view of this set.
 boolean contains(long e)
          Returns true if this set contains the specified number; false otherwise.
 boolean containsInterval(long first, long last)
          Returns true if this set contains all the numbers between first and last, inclusive; false otherwise.
 java.util.Iterator descendingIntervalIterator()
          Returns an iterator over intervals of this set, in a decreasing numerical order.
 LongInterval enclosingInterval(long e)
          Returns the widest interval contained in this set that includes the specified number, or null if this set does not include the specified number.
 long first()
          Returns the smallest number in this set.
 LongInterval firstInterval()
          Returns the first (left-most), widest interval contained in this set, or null if this set is empty.
 LongInterval floorInterval(long n)
          Returns the largest (right-most), widest interval contained in this set which elements are not all greater than the specified number.
 LongInterval higherInterval(long n)
          Returns the smallest (left-most), widest interval contained in this set which all elements are strictly greater than the specified number.
 int intervalCount()
          Returns the minimum count of intervals into which this set can be decomposed.
 java.util.Iterator intervalIterator()
          Returns an iterator over intervals of this set, in an increasing numerical order.
 long last()
          Returns the largest number in this set.
 LongInterval lastInterval()
          Returns the last (right-most), widest interval contained in this set, or null if this set is empty.
 LongInterval lowerInterval(long n)
          Returns the largest and widest interval contained in this set which all elements are strictly less than the specified number.
 long max()
          The largest number that can be stored in this set.
 long min()
          The smallest number that can be stored in this set.
 LongInterval pollFirstInterval()
          Returns and removes the first (left-most), widest interval contained in this set, or null if this set is empty.
 LongInterval pollLastInterval()
          Returns and removes the last (right-most), widest interval contained in this set, or null if this set is empty.
 LongSortedSet subSet(long first, long last)
          A subset view containing all elements from this set between first, inclusive, and last, inclusive.
 
Methods inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongSortedSet
ceiling, descendingIterator, floor, headSet, higher, isEmpty, iterator, lower, pollFirst, pollLast, retainAll, retainInterval, size64, tailSet, toCompactString
 
Methods inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongSet
addAll, addInterval, equals, hashCode, removeAll, removeInterval
 
Methods inherited from class edu.emory.mathcs.util.collections.longs.AbstractLongCollection
add, clear, containsAll, remove, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.emory.mathcs.util.collections.longs.LongSortedSet
toString
 
Methods inherited from interface edu.emory.mathcs.util.collections.longs.LongSet
add, addAll, addInterval, clear, containsAll, equals, hashCode, remove, removeAll, removeInterval, size, toArray, toArray
 

Method Detail

min

public long min()
Description copied from interface: LongSet
The smallest number that can be stored in this set.

Specified by:
min in interface LongSet
Overrides:
min in class AbstractLongSet

max

public long max()
Description copied from interface: LongSet
The largest number that can be stored in this set.

Specified by:
max in interface LongSet
Overrides:
max in class AbstractLongSet

first

public long first()
Description copied from interface: LongSortedSet
Returns the smallest number in this set.

Specified by:
first in interface LongSortedSet
Overrides:
first in class AbstractLongSortedSet

last

public long last()
Description copied from interface: LongSortedSet
Returns the largest number in this set.

Specified by:
last in interface LongSortedSet
Overrides:
last in class AbstractLongSortedSet

contains

public boolean contains(long e)
Description copied from interface: LongSet
Returns true if this set contains the specified number; false otherwise.

Specified by:
contains in interface LongSet
Overrides:
contains in class AbstractLongCollection

containsInterval

public boolean containsInterval(long first,
                                long last)
Description copied from interface: LongSet
Returns true if this set contains all the numbers between first and last, inclusive; false otherwise.

Specified by:
containsInterval in interface LongSet
Overrides:
containsInterval in class AbstractLongSet

enclosingInterval

public LongInterval enclosingInterval(long e)
Description copied from interface: LongSortedSet
Returns the widest interval contained in this set that includes the specified number, or null if this set does not include the specified number.

Returns:
the interval containing the specified number.

higherInterval

public LongInterval higherInterval(long n)
Description copied from interface: LongSortedSet
Returns the smallest (left-most), widest interval contained in this set which all elements are strictly greater than the specified number.

Returns:
the smallest interval greater than the specified number.

ceilingInterval

public LongInterval ceilingInterval(long n)
Description copied from interface: LongSortedSet
Returns the smallest (left-most), widest interval contained in this set which elements are not all smaller than the specified number. In other words, it either includes the specified number or has all elements strictly greater than the specified number.

Returns:
the smallest interval which upper bound is >= than the specified number.

lowerInterval

public LongInterval lowerInterval(long n)
Description copied from interface: LongSortedSet
Returns the largest and widest interval contained in this set which all elements are strictly less than the specified number.

Returns:
the largest interval smaller than the specified number.

floorInterval

public LongInterval floorInterval(long n)
Description copied from interface: LongSortedSet
Returns the largest (right-most), widest interval contained in this set which elements are not all greater than the specified number. In other words, it either includes the specified number or has all elements strictly less than the specified number.

Returns:
the largest interval which lower bound is <= than the specified number.

firstInterval

public LongInterval firstInterval()
Description copied from interface: LongSortedSet
Returns the first (left-most), widest interval contained in this set, or null if this set is empty.

Specified by:
firstInterval in interface LongSortedSet
Overrides:
firstInterval in class AbstractLongSortedSet

lastInterval

public LongInterval lastInterval()
Description copied from interface: LongSortedSet
Returns the last (right-most), widest interval contained in this set, or null if this set is empty.

Specified by:
lastInterval in interface LongSortedSet
Overrides:
lastInterval in class AbstractLongSortedSet

pollFirstInterval

public LongInterval pollFirstInterval()
Description copied from interface: LongSortedSet
Returns and removes the first (left-most), widest interval contained in this set, or null if this set is empty.

Specified by:
pollFirstInterval in interface LongSortedSet
Overrides:
pollFirstInterval in class AbstractLongSortedSet

pollLastInterval

public LongInterval pollLastInterval()
Description copied from interface: LongSortedSet
Returns and removes the last (right-most), widest interval contained in this set, or null if this set is empty.

Specified by:
pollLastInterval in interface LongSortedSet
Overrides:
pollLastInterval in class AbstractLongSortedSet

intervalCount

public int intervalCount()
Description copied from interface: LongSortedSet
Returns the minimum count of intervals into which this set can be decomposed. For instance, {1, 3,4,5, 8,9}.intervalCount() == 3.

Specified by:
intervalCount in interface LongSortedSet
Overrides:
intervalCount in class AbstractLongSortedSet

subSet

public LongSortedSet subSet(long first,
                            long last)
Description copied from interface: LongSortedSet
A subset view containing all elements from this set between first, inclusive, and last, inclusive. More precisely, the view is narrowed to the domain [min, max]. Hence, complement set of this set will NOT include any elements outside [min, max].

Parameters:
first - the minimum element of this view (inclusive).
last - the maximum element of this view (inclusive).
Returns:
the subset view

complementSet

public LongSet complementSet()
Description copied from interface: LongSet
Returns a complement view of this set. Complement view is a set that has the same domain as this set, and consists of all numbers from the domain that are not contained in this set. Changes done to this set are reflected in the complement view after it is created.

Specified by:
complementSet in interface LongSet
Overrides:
complementSet in class AbstractLongSet

intervalIterator

public java.util.Iterator intervalIterator()
Description copied from interface: LongSortedSet
Returns an iterator over intervals of this set, in an increasing numerical order.

Returns:
an iterator over intervals of this set

descendingIntervalIterator

public java.util.Iterator descendingIntervalIterator()
Description copied from interface: LongSortedSet
Returns an iterator over intervals of this set, in a decreasing numerical order.

Returns:
a descending iterator over intervals of this set