public class ConcurrentBits extends org.mini2Dx.gdx.utils.Bits implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentBits() |
ConcurrentBits(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.
|
Modifier and Type | Method and Description |
---|---|
void |
and(org.mini2Dx.gdx.utils.Bits other)
Performs a logical AND of this target bit set with the argument bit set.
|
void |
andNot(org.mini2Dx.gdx.utils.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(org.mini2Dx.gdx.utils.Bits other)
Returns true if this bit set is a super set of the specified set, i.e.
|
boolean |
equals(java.lang.Object obj) |
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.
|
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
boolean |
intersects(org.mini2Dx.gdx.utils.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(org.mini2Dx.gdx.utils.Bits other)
Performs a logical OR of this bit set with the bit set argument.
|
void |
set(int index) |
void |
xor(org.mini2Dx.gdx.utils.Bits other)
Performs a logical XOR of this bit set with the bit set argument.
|
protected ReadWriteLock lock
public ConcurrentBits()
public ConcurrentBits(int nbits)
nbits
- the initial size of the bit setpublic boolean get(int index)
get
in class org.mini2Dx.gdx.utils.Bits
index
- the index of the bitjava.lang.ArrayIndexOutOfBoundsException
- if index is less than 0public boolean getAndClear(int index)
getAndClear
in class org.mini2Dx.gdx.utils.Bits
index
- the index of the bitjava.lang.ArrayIndexOutOfBoundsException
- if index is less than 0public boolean getAndSet(int index)
getAndSet
in class org.mini2Dx.gdx.utils.Bits
index
- the index of the bitjava.lang.ArrayIndexOutOfBoundsException
- if index is less than 0public void set(int index)
set
in class org.mini2Dx.gdx.utils.Bits
index
- the index of the bit to setjava.lang.ArrayIndexOutOfBoundsException
- if index is less than 0public void flip(int index)
flip
in class org.mini2Dx.gdx.utils.Bits
index
- the index of the bit to flippublic void clear(int index)
clear
in class org.mini2Dx.gdx.utils.Bits
index
- the index of the bit to clearjava.lang.ArrayIndexOutOfBoundsException
- if index is less than 0public void clear()
clear
in class org.mini2Dx.gdx.utils.Bits
public int numBits()
numBits
in class org.mini2Dx.gdx.utils.Bits
public int length()
length
in class org.mini2Dx.gdx.utils.Bits
public boolean isEmpty()
isEmpty
in class org.mini2Dx.gdx.utils.Bits
public int nextSetBit(int fromIndex)
nextSetBit
in class org.mini2Dx.gdx.utils.Bits
fromIndex
- public int nextClearBit(int fromIndex)
nextClearBit
in class org.mini2Dx.gdx.utils.Bits
fromIndex
- public void and(org.mini2Dx.gdx.utils.Bits other)
and
in class org.mini2Dx.gdx.utils.Bits
other
- a bit setpublic void andNot(org.mini2Dx.gdx.utils.Bits other)
andNot
in class org.mini2Dx.gdx.utils.Bits
other
- a bit setpublic void or(org.mini2Dx.gdx.utils.Bits other)
or
in class org.mini2Dx.gdx.utils.Bits
other
- a bit setpublic void xor(org.mini2Dx.gdx.utils.Bits other)
xor
in class org.mini2Dx.gdx.utils.Bits
other
- public boolean intersects(org.mini2Dx.gdx.utils.Bits other)
intersects
in class org.mini2Dx.gdx.utils.Bits
other
- a bit setpublic boolean containsAll(org.mini2Dx.gdx.utils.Bits other)
containsAll
in class org.mini2Dx.gdx.utils.Bits
other
- a bit setpublic int hashCode()
hashCode
in class org.mini2Dx.gdx.utils.Bits
public boolean equals(java.lang.Object obj)
equals
in class org.mini2Dx.gdx.utils.Bits
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock