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