ch.javasoft.util.intcoll
Class AbstractSortedIntSet

java.lang.Object
  extended by ch.javasoft.util.intcoll.AbstractIntCollection
      extended by ch.javasoft.util.intcoll.AbstractSortedIntSet
All Implemented Interfaces:
IntCollection, IntIterable, IntSet, SortedIntSet, Iterable<Integer>, Collection<Integer>, Set<Integer>, SortedSet<Integer>
Direct Known Subclasses:
BitSetIntSet, DefaultIntSet, RangeIntSet

public abstract class AbstractSortedIntSet
extends AbstractIntCollection
implements SortedIntSet

Implementation of IntSet, also implementing SortedSet, but with support limited to positive integers.


Field Summary
 
Fields inherited from class ch.javasoft.util.intcoll.AbstractIntCollection
mod
 
Constructor Summary
AbstractSortedIntSet()
           
AbstractSortedIntSet(int[] values)
           
AbstractSortedIntSet(IntCollection set)
           
 
Method Summary
 boolean equals(Object obj)
           
 SortedIntSet headSet(int toElement)
          Returns a view of the portion of this set whose elements are strictly less than toElement.
 SortedIntSet headSet(Integer toElement)
           
 SortedIntSet subSet(Integer fromElement, Integer toElement)
           
 SortedIntSet tailSet(int fromElement)
          Returns a view of the portion of this set whose elements are greater than or equal to fromElement.
 SortedIntSet tailSet(Integer fromElement)
           
 
Methods inherited from class ch.javasoft.util.intcoll.AbstractIntCollection
add, addAll, addAll, addAll, addInt, clear, clone, contains, containsAll, containsInt, first, firstInt, hashCode, intIterator, isEmpty, iterator, last, lastInt, remove, removeAll, removeInt, retainAll, size, toArray, toArray, toArrayInternal, toIntArray, toIntArray, toIntArrayInternal, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.javasoft.util.intcoll.SortedIntSet
subSet
 
Methods inherited from interface ch.javasoft.util.intcoll.IntCollection
addAll, addAll, addInt, containsInt, intIterator, removeInt, toIntArray, toIntArray
 
Methods inherited from interface java.util.SortedSet
comparator, first, last
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

AbstractSortedIntSet

public AbstractSortedIntSet()

AbstractSortedIntSet

public AbstractSortedIntSet(IntCollection set)

AbstractSortedIntSet

public AbstractSortedIntSet(int[] values)
Method Detail

subSet

public SortedIntSet subSet(Integer fromElement,
                           Integer toElement)
Specified by:
subSet in interface SortedIntSet
Specified by:
subSet in interface SortedSet<Integer>

headSet

public SortedIntSet headSet(int toElement)
Description copied from interface: SortedIntSet
Returns a view of the portion of this set whose elements are strictly less than toElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Specified by:
headSet in interface SortedIntSet
Parameters:
toElement - high endpoint (exclusive) of the returned set
Returns:
a view of the portion of this set whose elements are strictly less than toElement

headSet

public SortedIntSet headSet(Integer toElement)
Specified by:
headSet in interface SortedIntSet
Specified by:
headSet in interface SortedSet<Integer>

tailSet

public SortedIntSet tailSet(int fromElement)
Description copied from interface: SortedIntSet
Returns a view of the portion of this set whose elements are greater than or equal to fromElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Specified by:
tailSet in interface SortedIntSet
Parameters:
fromElement - low endpoint (inclusive) of the returned set
Returns:
a view of the portion of this set whose elements are greater than or equal to fromElement

tailSet

public SortedIntSet tailSet(Integer fromElement)
Specified by:
tailSet in interface SortedIntSet
Specified by:
tailSet in interface SortedSet<Integer>

equals

public boolean equals(Object obj)
Specified by:
equals in interface Collection<Integer>
Specified by:
equals in interface Set<Integer>
Overrides:
equals in class AbstractIntCollection