|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.tumba.ngram.compression.ByteSet
public final class ByteSet
A set of bytes. Supports add operations, containment queries, and may be cleared.
Field Summary | |
---|---|
private long |
_bits1
Representation of bytes -128..-65. |
private long |
_bits2
Representation of bytes -64..-1. |
private long |
_bits3
Representation of bytes // 0..63. |
private long |
_bits4
Representation of bytes 64..127. |
(package private) static ByteSet |
EMPTY_SET
An empty set. |
Constructor Summary | |
---|---|
ByteSet()
Construct a byte set. |
Method Summary | |
---|---|
void |
add(byte b)
Add a byte to this set. |
void |
add(ByteSet that)
Adds all the members of specified set to this set. |
void |
add(int i)
Adds a byte, specified as an integer, to this set. |
static int |
byteToInteger(byte b)
Returns integer code for the specified byte. |
void |
clear()
Remove all of the bytes from this set. |
boolean |
contains(byte b)
Returns true if specified byte is a member
of this set. |
boolean |
contains(int i)
Returns true if byte specified as an integer
is a member of this set. |
static byte |
integerToByte(int i)
Returns byte coded by the specified integer. |
void |
remove(byte b)
Removes a byte from this set. |
void |
remove(ByteSet that)
Removes all the members of specified set from this set. |
void |
remove(int i)
Removes a byte, specified as an integer, from this set. |
void |
restrict(ByteSet that)
Removes all the elements of this set that are not in the specified set. |
int |
size()
Returns number of elements in this set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final ByteSet EMPTY_SET
private long _bits1
private long _bits2
private long _bits3
private long _bits4
Constructor Detail |
---|
public ByteSet()
Method Detail |
---|
public void clear()
public void add(int i)
i
- Byte to add to this set.public void add(byte b)
b
- Byte to add to this set.public void remove(int i)
i
- Integer specification of byte to remove from this set.public void remove(byte b)
b
- Byte to remove from this set.public void add(ByteSet that)
that
- Byte set to add to this set.public void remove(ByteSet that)
that
- Byte set to remove from this set.public void restrict(ByteSet that)
that
- Byte set to restrict this set to.public boolean contains(int i)
true
if byte specified as an integer
is a member of this set. Conversion is done by casting.
i
- Integer representation of byte to be tested for membership.
true
if the specified byte is a member of this set.public boolean contains(byte b)
true
if specified byte is a member
of this set.
b
- Byte to test for membership in this set.
true
if the specified byte is a member of this set.public int size()
public static byte integerToByte(int i)
i
- Integer to conver to a byte.
public static int byteToInteger(byte b)
b
- Byte to code as an integer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |