|
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.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 FormConstructor 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 ByteSortedSet
add
in class AbstractByteCollection
public ByteIterator iterator()
ByteCollection
iterator
in interface ByteCollection
public byte first()
ByteSortedSet
first
in interface ByteSortedSet
public byte last()
ByteSortedSet
last
in interface ByteSortedSet
public ByteSortedSet headSet(byte to)
ByteSortedSet
headSet
in interface ByteSortedSet
to
- the upper bound of the returned set (not included).public ByteSortedSet tailSet(byte from)
ByteSortedSet
tailSet
in interface ByteSortedSet
from
- the lower bound of the returned set (included).public ByteSortedSet subSet(byte from, byte to)
ByteSortedSet
subSet
in interface ByteSortedSet
from
- 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 AbstractByteCollection
public void trimToSize()
ByteCollection
trimToSize
in interface ByteCollection
trimToSize
in class AbstractByteCollection
public Object clone()
public void clear()
ByteCollection
clear
in interface ByteCollection
clear
in class AbstractByteCollection
public boolean contains(byte v)
ByteCollection
contains
in interface ByteCollection
contains
in class AbstractByteCollection
public int hashCode()
ByteCollection
hashCode
in interface ByteCollection
hashCode
in class AbstractByteSet
public boolean isEmpty()
ByteCollection
isEmpty
in interface ByteCollection
isEmpty
in class AbstractByteCollection
public int size()
ByteCollection
size
in interface ByteCollection
size
in class AbstractByteCollection
public boolean remove(byte v)
ByteCollection
remove
in interface ByteCollection
remove
in class AbstractByteCollection
public byte[] toArray(byte[] a)
ByteCollection
toArray
in interface ByteCollection
toArray
in class AbstractByteCollection
public 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 |