|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbak.pcj.AbstractIntCollection
bak.pcj.set.AbstractIntSet
bak.pcj.set.IntRangeSet
This class represents range based sets of int values. The implementation is optimized for cases where most set elements fall into ranges of consecutive int values.
Implementation of IntSortedSet is supported from PCJ 1.2. Prior to 1.2, only IntSet was implemented.
IntRange,
Serialized Form| Constructor Summary | |
IntRangeSet()
Creates a new empty range set. |
|
IntRangeSet(int[] a)
Creates a new empty range set containing specified values. |
|
IntRangeSet(IntCollection c)
Creates a new range set with the same elements as a specified collection. |
|
| Method Summary | |
boolean |
add(int v)
Adds an element to this set. |
boolean |
addAll(int[] a)
Adds an array of int values to this set. |
boolean |
addAll(int first,
int last)
Adds a specified range to this set. |
boolean |
addAll(IntRange range)
Adds a specified range to this set. |
boolean |
addAll(IntRangeSet c)
Adds all the elements of a specified range set to this set. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this range set. |
boolean |
contains(int v)
Indicates whether this collection contains a specified element. |
boolean |
containsAll(IntRange range)
Indicates whether all elements of a specified range is contained in this set. |
int |
first()
Returns the lowest element of this set. |
int |
hashCode()
Returns a hash code value for this collection. |
IntSortedSet |
headSet(int to)
Returns the subset of values lower than a specified value. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
IntIterator |
iterator()
Returns an iterator over this collection. |
int |
last()
Returns the highest element of this set. |
IntRange[] |
ranges()
Returns the ranges of this set. |
boolean |
remove(int v)
Removes a specified element from this collection. |
int |
size()
Returns the number of elements in this collection. |
IntSortedSet |
subSet(int from,
int to)
Returns the subset of values lower that a specified value and higher than or equal to another specified value. |
IntSortedSet |
tailSet(int from)
Returns the subset of values higher than or equal to a specified value. |
int[] |
toArray(int[] a)
Returns the elements of this collection as an array. |
String |
toString()
Returns a string representation of this collection. |
void |
trimToSize()
Minimizes the memory used by this collection. |
| Methods inherited from class bak.pcj.set.AbstractIntSet |
equals |
| Methods inherited from class bak.pcj.AbstractIntCollection |
addAll, containsAll, removeAll, retainAll, toArray |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface bak.pcj.IntCollection |
addAll, containsAll, equals, removeAll, retainAll, toArray |
| Constructor Detail |
public IntRangeSet()
public IntRangeSet(int[] a)
a - the values that the new set should contain.
NullPointerException - if a is null.public IntRangeSet(IntCollection c)
c - the collection whose elements to add to the new
set.
NullPointerException - if c is null.| Method Detail |
public boolean add(int v)
IntSortedSet
add in interface IntSortedSetadd in class AbstractIntCollectionpublic IntIterator iterator()
IntCollection
iterator in interface IntCollectionpublic int first()
IntSortedSet
first in interface IntSortedSetpublic int last()
IntSortedSet
last in interface IntSortedSetpublic IntSortedSet headSet(int to)
IntSortedSet
headSet in interface IntSortedSetto - the upper bound of the returned set (not included).public IntSortedSet tailSet(int from)
IntSortedSet
tailSet in interface IntSortedSetfrom - the lower bound of the returned set (included).
public IntSortedSet subSet(int from,
int to)
IntSortedSet
subSet in interface IntSortedSetfrom - the lower bound of the returned set (included).to - the upper bound of the returned set (not included).public String toString()
AbstractIntCollection
toString in class AbstractIntCollectionpublic void trimToSize()
IntCollection
trimToSize in interface IntCollectiontrimToSize in class AbstractIntCollectionpublic Object clone()
public void clear()
IntCollection
clear in interface IntCollectionclear in class AbstractIntCollectionpublic boolean contains(int v)
IntCollection
contains in interface IntCollectioncontains in class AbstractIntCollectionpublic int hashCode()
IntCollection
hashCode in interface IntCollectionhashCode in class AbstractIntSetpublic boolean isEmpty()
IntCollection
isEmpty in interface IntCollectionisEmpty in class AbstractIntCollectionpublic int size()
IntCollection
size in interface IntCollectionsize in class AbstractIntCollectionpublic boolean remove(int v)
IntCollection
remove in interface IntCollectionremove in class AbstractIntCollectionpublic int[] toArray(int[] a)
IntCollection
toArray in interface IntCollectiontoArray in class AbstractIntCollectionpublic boolean containsAll(IntRange range)
range - the range whose elements to test for
containment.
NullPointerException - if range is null.AbstractIntCollection.containsAll(IntCollection)public boolean addAll(IntRangeSet c)
c - the set whose elements to add to this
set.
NullPointerException - if c is null.add(int),
addAll(IntRange),
AbstractIntCollection.addAll(IntCollection),
addAll(int, int),
addAll(int[])public boolean addAll(IntRange range)
range - the range to add to this set.
NullPointerException - if range is null.add(int),
addAll(IntRangeSet),
AbstractIntCollection.addAll(IntCollection),
addAll(int, int),
addAll(int[])
public boolean addAll(int first,
int last)
first - the first value of the range to add to this set.last - the last value of the range to add to this set.
IllegalArgumentException - if first > last.public boolean addAll(int[] a)
a - the array of int values to add to this set.
NullPointerException - if a is null.add(int),
addAll(IntRange),
addAll(IntRangeSet),
AbstractIntCollection.addAll(IntCollection),
addAll(int, int)public IntRange[] ranges()
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||