| |
|
| bak.pcj.set.AbstractShortSet bak.pcj.set.ShortRangeSet
ShortRangeSet | public class ShortRangeSet extends AbstractShortSet implements ShortSortedSet,Cloneable,Serializable(Code) | | 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.
See Also: ShortRange author: Søren Bak version: 1.3 20-08-2003 22:24 since: 1.0 |
Constructor Summary | |
public | ShortRangeSet() Creates a new empty range set. | public | ShortRangeSet(short[] a) Creates a new empty range set containing specified values. | public | ShortRangeSet(ShortCollection c) Creates a new range set with the same elements as a specified
collection. |
Method Summary | |
public boolean | add(short v) | public boolean | addAll(ShortRangeSet c) Adds all the elements of a specified range set to
this set.
Parameters: c - the set whose elements to add to thisset. | public boolean | addAll(ShortRange range) Adds a specified range to this set.
Parameters: range - the range to add to this set. | public boolean | addAll(short first, short last) Adds a specified range to this set.
Parameters: first - the first value of the range to add to this set. Parameters: last - the last value of the range to add to this set. | public boolean | addAll(short[] a) Adds an array of short values to this set. | public void | clear() | public Object | clone() Returns a clone of this range set. | public boolean | contains(short v) | public boolean | containsAll(ShortRange range) Indicates whether all elements of a specified
range is contained in this set.
Parameters: range - the range whose elements to test forcontainment. | public short | first() | public int | hashCode() | public ShortSortedSet | headSet(short to) | public boolean | isEmpty() | public ShortIterator | iterator() | public short | last() | public ShortRange[] | ranges() Returns the ranges of this set. | public boolean | remove(short v) | public int | size() | public ShortSortedSet | subSet(short from, short to) | public ShortSortedSet | tailSet(short from) | public short[] | toArray(short[] a) | public String | toString() | public void | trimToSize() |
ShortRangeSet | public ShortRangeSet()(Code) | | Creates a new empty range set.
|
ShortRangeSet | public ShortRangeSet(short[] a)(Code) | | Creates a new empty range set containing specified values.
Parameters: a - the values that the new set should contain. throws: NullPointerException - if a is null. |
ShortRangeSet | public ShortRangeSet(ShortCollection c)(Code) | | Creates a new range set with the same elements as a specified
collection.
Parameters: c - the collection whose elements to add to the newset. throws: NullPointerException - if c is null. |
add | public boolean add(short v)(Code) | | |
addAll | public boolean addAll(short first, short last)(Code) | | Adds a specified range to this set.
Parameters: first - the first value of the range to add to this set. Parameters: last - the last value of the range to add to this set. true if this set was modifiedas a result of adding the values firstto last; returns falseotherwise. throws: IllegalArgumentException - if first > last. |
clear | public void clear()(Code) | | |
clone | public Object clone()(Code) | | Returns a clone of this range set.
a clone of this range set. since: 1.1 |
contains | public boolean contains(short v)(Code) | | |
containsAll | public boolean containsAll(ShortRange range)(Code) | | Indicates whether all elements of a specified
range is contained in this set.
Parameters: range - the range whose elements to test forcontainment. true if all the elements of rangeare contained in this collection; returnsfalse otherwise. throws: NullPointerException - if range is null. See Also: ShortRangeSet.containsAll(ShortCollection) |
first | public short first()(Code) | | since: 1.2 |
hashCode | public int hashCode()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | |
last | public short last()(Code) | | since: 1.2 |
ranges | public ShortRange[] ranges()(Code) | | Returns the ranges of this set. None of the ranges returned
will overlap or be adjacent.
the ranges of this set. The returned array isa fresh copy that can be modified withoutmodifying this set. |
remove | public boolean remove(short v)(Code) | | |
toArray | public short[] toArray(short[] a)(Code) | | |
trimToSize | public void trimToSize()(Code) | | |
|
|
|