|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bak.pcj.AbstractShortCollection bak.pcj.set.AbstractShortSet bak.pcj.set.ShortRangeSet
This class represents range based sets of short values. The implementation is optimized for cases where most set elements fall into ranges of consecutive short values.
Implementation of ShortSortedSet is supported from PCJ 1.2. Prior to 1.2, only ShortSet was implemented.
ShortRange
,
Serialized FormConstructor Summary | |
ShortRangeSet()
Creates a new empty range set. |
|
ShortRangeSet(short[] a)
Creates a new empty range set containing specified values. |
|
ShortRangeSet(ShortCollection c)
Creates a new range set with the same elements as a specified collection. |
Method Summary | |
boolean |
add(short v)
Adds an element to this set. |
boolean |
addAll(short[] a)
Adds an array of short values to this set. |
boolean |
addAll(ShortRange range)
Adds a specified range to this set. |
boolean |
addAll(ShortRangeSet c)
Adds all the elements of a specified range set to this set. |
boolean |
addAll(short first,
short last)
Adds a specified range to this set. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this range set. |
boolean |
contains(short v)
Indicates whether this collection contains a specified element. |
boolean |
containsAll(ShortRange range)
Indicates whether all elements of a specified range is contained in this set. |
short |
first()
Returns the lowest element of this set. |
int |
hashCode()
Returns a hash code value for this collection. |
ShortSortedSet |
headSet(short to)
Returns the subset of values lower than a specified value. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
ShortIterator |
iterator()
Returns an iterator over this collection. |
short |
last()
Returns the highest element of this set. |
ShortRange[] |
ranges()
Returns the ranges of this set. |
boolean |
remove(short v)
Removes a specified element from this collection. |
int |
size()
Returns the number of elements in this collection. |
ShortSortedSet |
subSet(short from,
short to)
Returns the subset of values lower that a specified value and higher than or equal to another specified value. |
ShortSortedSet |
tailSet(short from)
Returns the subset of values higher than or equal to a specified value. |
short[] |
toArray(short[] 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.AbstractShortSet |
equals |
Methods inherited from class bak.pcj.AbstractShortCollection |
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.ShortCollection |
addAll, containsAll, equals, removeAll, retainAll, toArray |
Constructor Detail |
public ShortRangeSet()
public ShortRangeSet(short[] a)
a
- the values that the new set should contain.
NullPointerException
- if a is null.public ShortRangeSet(ShortCollection c)
c
- the collection whose elements to add to the new
set.
NullPointerException
- if c is null.Method Detail |
public boolean add(short v)
ShortSortedSet
add
in interface ShortSortedSet
add
in class AbstractShortCollection
public ShortIterator iterator()
ShortCollection
iterator
in interface ShortCollection
public short first()
ShortSortedSet
first
in interface ShortSortedSet
public short last()
ShortSortedSet
last
in interface ShortSortedSet
public ShortSortedSet headSet(short to)
ShortSortedSet
headSet
in interface ShortSortedSet
to
- the upper bound of the returned set (not included).public ShortSortedSet tailSet(short from)
ShortSortedSet
tailSet
in interface ShortSortedSet
from
- the lower bound of the returned set (included).public ShortSortedSet subSet(short from, short to)
ShortSortedSet
subSet
in interface ShortSortedSet
from
- the lower bound of the returned set (included).to
- the upper bound of the returned set (not included).public String toString()
AbstractShortCollection
toString
in class AbstractShortCollection
public void trimToSize()
ShortCollection
trimToSize
in interface ShortCollection
trimToSize
in class AbstractShortCollection
public Object clone()
public void clear()
ShortCollection
clear
in interface ShortCollection
clear
in class AbstractShortCollection
public boolean contains(short v)
ShortCollection
contains
in interface ShortCollection
contains
in class AbstractShortCollection
public int hashCode()
ShortCollection
hashCode
in interface ShortCollection
hashCode
in class AbstractShortSet
public boolean isEmpty()
ShortCollection
isEmpty
in interface ShortCollection
isEmpty
in class AbstractShortCollection
public int size()
ShortCollection
size
in interface ShortCollection
size
in class AbstractShortCollection
public boolean remove(short v)
ShortCollection
remove
in interface ShortCollection
remove
in class AbstractShortCollection
public short[] toArray(short[] a)
ShortCollection
toArray
in interface ShortCollection
toArray
in class AbstractShortCollection
public boolean containsAll(ShortRange range)
range
- the range whose elements to test for
containment.
NullPointerException
- if range is null.AbstractShortCollection.containsAll(ShortCollection)
public boolean addAll(ShortRangeSet c)
c
- the set whose elements to add to this
set.
NullPointerException
- if c is null.add(short)
,
addAll(ShortRange)
,
AbstractShortCollection.addAll(ShortCollection)
,
addAll(short, short)
,
addAll(short[])
public boolean addAll(ShortRange range)
range
- the range to add to this set.
NullPointerException
- if range is null.add(short)
,
addAll(ShortRangeSet)
,
AbstractShortCollection.addAll(ShortCollection)
,
addAll(short, short)
,
addAll(short[])
public boolean addAll(short first, short 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(short[] a)
a
- the array of short values to add to this set.
NullPointerException
- if a is null.add(short)
,
addAll(ShortRange)
,
addAll(ShortRangeSet)
,
AbstractShortCollection.addAll(ShortCollection)
,
addAll(short, short)
public ShortRange[] ranges()
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |