public class ConcurrentByteArray extends org.mini2Dx.gdx.utils.ByteArray implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentByteArray()
Creates an ordered array with a capacity of 16.
|
ConcurrentByteArray(boolean ordered,
byte[] array,
int startIndex,
int count)
Creates a new array containing the elements in the specified array.
|
ConcurrentByteArray(boolean ordered,
int capacity) |
ConcurrentByteArray(byte[] array)
Creates a new ordered array containing the elements in the specified array.
|
ConcurrentByteArray(org.mini2Dx.gdx.utils.ByteArray array)
Creates a new array containing the elements in the specific array.
|
ConcurrentByteArray(int capacity)
Creates an ordered array with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(byte value) |
void |
add(byte value1,
byte value2) |
void |
add(byte value1,
byte value2,
byte value3) |
void |
add(byte value1,
byte value2,
byte value3,
byte value4) |
void |
addAll(byte[] array,
int offset,
int length) |
void |
addAll(org.mini2Dx.gdx.utils.ByteArray array,
int offset,
int length) |
void |
clear() |
boolean |
contains(byte value) |
byte[] |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object object)
Returns false if either array is unordered.
|
byte |
first()
Returns the first item.
|
byte |
get(int index) |
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
void |
incr(int index,
byte value) |
int |
indexOf(byte value) |
void |
insert(int index,
byte value) |
boolean |
isEmpty()
Returns true if the array is empty.
|
int |
lastIndexOf(byte value) |
void |
mul(int index,
byte value) |
boolean |
notEmpty()
Returns true if the array has one or more items.
|
byte |
peek()
Returns the last item.
|
byte |
pop()
Removes and returns the last item.
|
byte |
random()
Returns a random item from the array, or false if the array is empty.
|
boolean |
removeAll(org.mini2Dx.gdx.utils.ByteArray array)
Removes from this array all of elements contained in the specified array.
|
int |
removeIndex(int index)
Removes and returns the item at the specified index.
|
void |
removeRange(int start,
int end)
Removes the items between the specified indices, inclusive.
|
boolean |
removeValue(byte value) |
void |
reverse() |
void |
set(int index,
byte value) |
byte[] |
setSize(int newSize)
Sets the array size, leaving any values beyond the current size undefined.
|
byte[] |
shrink()
Reduces the size of the backing array to the size of the actual items.
|
void |
shuffle() |
void |
sort() |
void |
swap(int first,
int second) |
byte[] |
toArray() |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
void |
truncate(int newSize)
Reduces the size of the array to the specified size.
|
protected ReadWriteLock lock
public ConcurrentByteArray()
public ConcurrentByteArray(int capacity)
capacity
- public ConcurrentByteArray(boolean ordered, int capacity)
ordered
- If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy.capacity
- Any elements added beyond this will cause the backing array to be grown.public ConcurrentByteArray(org.mini2Dx.gdx.utils.ByteArray array)
array
- public ConcurrentByteArray(byte[] array)
array
- public ConcurrentByteArray(boolean ordered, byte[] array, int startIndex, int count)
ordered
- If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy.array
- startIndex
- count
- public void add(byte value)
add
in class org.mini2Dx.gdx.utils.ByteArray
public void add(byte value1, byte value2)
add
in class org.mini2Dx.gdx.utils.ByteArray
public void add(byte value1, byte value2, byte value3)
add
in class org.mini2Dx.gdx.utils.ByteArray
public void add(byte value1, byte value2, byte value3, byte value4)
add
in class org.mini2Dx.gdx.utils.ByteArray
public void addAll(byte[] array, int offset, int length)
addAll
in class org.mini2Dx.gdx.utils.ByteArray
public byte get(int index)
get
in class org.mini2Dx.gdx.utils.ByteArray
public void set(int index, byte value)
set
in class org.mini2Dx.gdx.utils.ByteArray
public void insert(int index, byte value)
insert
in class org.mini2Dx.gdx.utils.ByteArray
public void swap(int first, int second)
swap
in class org.mini2Dx.gdx.utils.ByteArray
public void addAll(org.mini2Dx.gdx.utils.ByteArray array, int offset, int length)
addAll
in class org.mini2Dx.gdx.utils.ByteArray
public int removeIndex(int index)
removeIndex
in class org.mini2Dx.gdx.utils.ByteArray
index
- public void removeRange(int start, int end)
removeRange
in class org.mini2Dx.gdx.utils.ByteArray
start
- end
- public byte pop()
pop
in class org.mini2Dx.gdx.utils.ByteArray
public byte peek()
peek
in class org.mini2Dx.gdx.utils.ByteArray
public byte first()
first
in class org.mini2Dx.gdx.utils.ByteArray
public boolean notEmpty()
notEmpty
in class org.mini2Dx.gdx.utils.ByteArray
public boolean isEmpty()
isEmpty
in class org.mini2Dx.gdx.utils.ByteArray
public void clear()
clear
in class org.mini2Dx.gdx.utils.ByteArray
public byte[] shrink()
shrink
in class org.mini2Dx.gdx.utils.ByteArray
ByteArray.items
public void incr(int index, byte value)
incr
in class org.mini2Dx.gdx.utils.ByteArray
public void mul(int index, byte value)
mul
in class org.mini2Dx.gdx.utils.ByteArray
public boolean contains(byte value)
contains
in class org.mini2Dx.gdx.utils.ByteArray
public int indexOf(byte value)
indexOf
in class org.mini2Dx.gdx.utils.ByteArray
public int lastIndexOf(byte value)
lastIndexOf
in class org.mini2Dx.gdx.utils.ByteArray
public boolean removeValue(byte value)
removeValue
in class org.mini2Dx.gdx.utils.ByteArray
public boolean removeAll(org.mini2Dx.gdx.utils.ByteArray array)
removeAll
in class org.mini2Dx.gdx.utils.ByteArray
array
- public void sort()
sort
in class org.mini2Dx.gdx.utils.ByteArray
public byte[] ensureCapacity(int additionalCapacity)
ensureCapacity
in class org.mini2Dx.gdx.utils.ByteArray
additionalCapacity
- ByteArray.items
public byte[] setSize(int newSize)
setSize
in class org.mini2Dx.gdx.utils.ByteArray
newSize
- ByteArray.items
public void reverse()
reverse
in class org.mini2Dx.gdx.utils.ByteArray
public void shuffle()
shuffle
in class org.mini2Dx.gdx.utils.ByteArray
public void truncate(int newSize)
truncate
in class org.mini2Dx.gdx.utils.ByteArray
newSize
- public byte random()
random
in class org.mini2Dx.gdx.utils.ByteArray
public byte[] toArray()
toArray
in class org.mini2Dx.gdx.utils.ByteArray
public int hashCode()
hashCode
in class org.mini2Dx.gdx.utils.ByteArray
public boolean equals(java.lang.Object object)
equals
in class org.mini2Dx.gdx.utils.ByteArray
object
- public java.lang.String toString()
toString
in class org.mini2Dx.gdx.utils.ByteArray
public java.lang.String toString(java.lang.String separator)
toString
in class org.mini2Dx.gdx.utils.ByteArray
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock