|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.utils.Bits
public class Bits
A bitset, without size limitation, allows comparison via bitwise operators to other bitfields.
Constructor Summary | |
---|---|
Bits()
|
|
Bits(int nbits)
Creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range 0 through nbits-1. |
Method Summary | |
---|---|
void |
and(Bits other)
Performs a logical AND of this target bit set with the argument bit set. |
void |
andNot(Bits other)
Clears all of the bits in this bit set whose corresponding bit is set in the specified bit set. |
void |
clear()
Clears the entire bitset |
void |
clear(int index)
|
boolean |
containsAll(Bits other)
Returns true if this bit set is a super set of the specified set, i.e. |
void |
flip(int index)
|
boolean |
get(int index)
|
boolean |
getAndClear(int index)
Returns the bit at the given index and clears it in one go. |
boolean |
getAndSet(int index)
Returns the bit at the given index and sets it in one go. |
boolean |
intersects(Bits other)
Returns true if the specified BitSet has any bits set to true that are also set to true in this BitSet. |
boolean |
isEmpty()
|
int |
length()
Returns the "logical size" of this bitset: the index of the highest set bit in the bitset plus one. |
int |
nextClearBit(int fromIndex)
Returns the index of the first bit that is set to false that occurs on or after the specified starting index. |
int |
nextSetBit(int fromIndex)
Returns the index of the first bit that is set to true that occurs on or after the specified starting index. |
int |
numBits()
|
void |
or(Bits other)
Performs a logical OR of this bit set with the bit set argument. |
void |
set(int index)
|
void |
xor(Bits other)
Performs a logical XOR of this bit set with the bit set argument. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bits()
public Bits(int nbits)
nbits
- the initial size of the bit setMethod Detail |
---|
public boolean get(int index)
index
- the index of the bit
ArrayIndexOutOfBoundsException
- if index < 0public boolean getAndClear(int index)
index
- the index of the bit
ArrayIndexOutOfBoundsException
- if index < 0public boolean getAndSet(int index)
index
- the index of the bit
ArrayIndexOutOfBoundsException
- if index < 0public void set(int index)
index
- the index of the bit to set
ArrayIndexOutOfBoundsException
- if index < 0public void flip(int index)
index
- the index of the bit to flippublic void clear(int index)
index
- the index of the bit to clear
ArrayIndexOutOfBoundsException
- if index < 0public void clear()
public int numBits()
public int length()
public boolean isEmpty()
public int nextSetBit(int fromIndex)
public int nextClearBit(int fromIndex)
public void and(Bits other)
other
- a bit setpublic void andNot(Bits other)
other
- a bit setpublic void or(Bits other)
other
- a bit setpublic void xor(Bits other)
other
- public boolean intersects(Bits other)
other
- a bit set
public boolean containsAll(Bits other)
other
- a bit set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |