edu.emory.mathcs.util.collections.shorts
Class AbstractShortInterval.ComplementView

java.lang.Object
  extended byedu.emory.mathcs.util.collections.shorts.AbstractShortCollection
      extended byedu.emory.mathcs.util.collections.shorts.AbstractShortSet
          extended byedu.emory.mathcs.util.collections.shorts.AbstractShortSortedSet
              extended byedu.emory.mathcs.util.collections.shorts.AbstractShortInterval.ComplementView
All Implemented Interfaces:
ShortCollection, ShortSet, ShortSortedSet
Enclosing class:
AbstractShortInterval

protected static class AbstractShortInterval.ComplementView
extends AbstractShortSortedSet


Nested Class Summary
 
Nested classes inherited from class edu.emory.mathcs.util.collections.shorts.AbstractShortSortedSet
AbstractShortSortedSet.AbstractComplementSubView, AbstractShortSortedSet.AbstractSubView, AbstractShortSortedSet.ForwardIntervalItemIterator, AbstractShortSortedSet.ReverseIntervalItemIterator
 
Method Summary
 ShortInterval ceilingInterval(short n)
          Returns the smallest (left-most), widest interval contained in this set which elements are not all smaller than the specified number.
 ShortSet complementSet()
          Returns a complement view of this set.
 boolean contains(short e)
          Returns true if this set contains the specified number; false otherwise.
 boolean containsInterval(short first, short 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.
 ShortInterval enclosingInterval(short 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.
 short first()
          Returns the smallest number in this set.
 ShortInterval firstInterval()
          Returns the first (left-most), widest interval contained in this set, or null if this set is empty.
 ShortInterval floorInterval(short n)
          Returns the largest (right-most), widest interval contained in this set which elements are not all greater than the specified number.
 ShortInterval higherInterval(short 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.
 short last()
          Returns the largest number in this set.
 ShortInterval lastInterval()
          Returns the last (right-most), widest interval contained in this set, or null if this set is empty.
 ShortInterval lowerInterval(short n)
          Returns the largest and widest interval contained in this set which all elements are strictly less than the specified number.
 short max()
          The largest number that can be stored in this set.
 short min()
          The smallest number that can be stored in this set.
 ShortInterval pollFirstInterval()
          Returns and removes the first (left-most), widest interval contained in this set, or null if this set is empty.
 ShortInterval pollLastInterval()
          Returns and removes the last (right-most), widest interval contained in this set, or null if this set is empty.
 ShortSortedSet subSet(short first, short 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.shorts.AbstractShortSortedSet
ceiling, descendingIterator, floor, headSet, higher, isEmpty, iterator, lower, pollFirst, pollLast, retainAll, retainInterval, size, tailSet, toCompactString
 
Methods inherited from class edu.emory.mathcs.util.collections.shorts.AbstractShortSet
addAll, addInterval, equals, hashCode, removeAll, removeInterval
 
Methods inherited from class edu.emory.mathcs.util.collections.shorts.AbstractShortCollection
add, clear, containsAll, remove, 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.shorts.ShortSortedSet
toString
 
Methods inherited from interface edu.emory.mathcs.util.collections.shorts.ShortSet
add, addAll, addInterval, clear, containsAll, equals, hashCode, remove, removeAll, removeInterval, toArray, toArray
 

Method Detail

min

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

Specified by:
min in interface ShortSet
Overrides:
min in class AbstractShortSet

max

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

Specified by:
max in interface ShortSet
Overrides:
max in class AbstractShortSet

first

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

Specified by:
first in interface ShortSortedSet
Overrides:
first in class AbstractShortSortedSet

last

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

Specified by:
last in interface ShortSortedSet
Overrides:
last in class AbstractShortSortedSet

contains

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

Specified by:
contains in interface ShortSet
Overrides:
contains in class AbstractShortCollection

containsInterval

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

Specified by:
containsInterval in interface ShortSet
Overrides:
containsInterval in class AbstractShortSet

enclosingInterval

public ShortInterval enclosingInterval(short e)
Description copied from interface: ShortSortedSet
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 ShortInterval higherInterval(short n)
Description copied from interface: ShortSortedSet
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 ShortInterval ceilingInterval(short n)
Description copied from interface: ShortSortedSet
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 ShortInterval lowerInterval(short n)
Description copied from interface: ShortSortedSet
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 ShortInterval floorInterval(short n)
Description copied from interface: ShortSortedSet
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 ShortInterval firstInterval()
Description copied from interface: ShortSortedSet
Returns the first (left-most), widest interval contained in this set, or null if this set is empty.

Specified by:
firstInterval in interface ShortSortedSet
Overrides:
firstInterval in class AbstractShortSortedSet

lastInterval

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

Specified by:
lastInterval in interface ShortSortedSet
Overrides:
lastInterval in class AbstractShortSortedSet

pollFirstInterval

public ShortInterval pollFirstInterval()
Description copied from interface: ShortSortedSet
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 ShortSortedSet
Overrides:
pollFirstInterval in class AbstractShortSortedSet

pollLastInterval

public ShortInterval pollLastInterval()
Description copied from interface: ShortSortedSet
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 ShortSortedSet
Overrides:
pollLastInterval in class AbstractShortSortedSet

intervalCount

public int intervalCount()
Description copied from interface: ShortSortedSet
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 ShortSortedSet
Overrides:
intervalCount in class AbstractShortSortedSet

subSet

public ShortSortedSet subSet(short first,
                             short last)
Description copied from interface: ShortSortedSet
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 ShortSet complementSet()
Description copied from interface: ShortSet
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 ShortSet
Overrides:
complementSet in class AbstractShortSet

intervalIterator

public java.util.Iterator intervalIterator()
Description copied from interface: ShortSortedSet
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: ShortSortedSet
Returns an iterator over intervals of this set, in a decreasing numerical order.

Returns:
a descending iterator over intervals of this set