public class SharedBuffer<T> extends CircularBuffer<T> implements IShared
DEFAULT_SIZE
Constructor and Description |
---|
SharedBuffer()
Default constructor.
|
SharedBuffer(java.lang.Class<?> genericTypeParameter)
Constructor for initializing with the generic type parameter
|
SharedBuffer(int bufferSize)
Initializes the buffer with a buffer size.
|
SharedBuffer(int bufferSize,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with a buffer size and a generic type parameter.
|
SharedBuffer(java.lang.Iterable<? extends T> values)
Constructor initializes from another collection
|
SharedBuffer(java.lang.Iterable<? extends T> values,
java.lang.Class<?> genericTypeParameter)
Constructor initializes from another collection and a generic type parameter
|
SharedBuffer(ReifiedIterable<T> values)
Constructor initializes from another reified collection
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Empties the buffer.
|
boolean |
contains(T obj)
Checks if an object is contained in the buffer.
|
T |
get()
Retrieves an object from the buffer.
|
boolean |
isEmpty()
Is empty method.
|
boolean |
isFull()
Is full method.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over a copy of the backing array.
|
void |
lock()
Locks the object
|
boolean |
put(T obj)
Puts an object in the Buffer.
|
int |
size()
Returns the size of the Buffer.
|
T[] |
toArray()
Puts all elements in an array copy and returns them.
|
ReifiedList<T> |
toList()
Puts all elements in a list copy and returns them.
|
java.lang.String |
toString() |
void |
unlock()
Unlocks the object.
|
getGenericTypeParameter, getMaxSize
public SharedBuffer()
SuperTypeTokenException
- When called without using anonymous class semantics.public SharedBuffer(java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When the generic type parameter is null.public SharedBuffer(int bufferSize)
java.lang.IllegalArgumentException
- When the buffer size is non positive.SuperTypeTokenException
- When called without using anonymous class semantics.public SharedBuffer(int bufferSize, java.lang.Class<?> genericTypeParameter)
java.lang.IllegalArgumentException
- When the buffer size is non positive.java.lang.NullPointerException
- When the generic type parameter is null.public SharedBuffer(ReifiedIterable<T> values)
java.lang.NullPointerException
- When the argument is null.java.lang.IllegalArgumentException
- When the values is an empty iterable.public SharedBuffer(java.lang.Iterable<? extends T> values)
SuperTypeTokenException
- When called without using anonymous class semantics.java.lang.IllegalArgumentException
- When the values is an empty iterable.java.lang.NullPointerException
- When the argument is nullpublic SharedBuffer(java.lang.Iterable<? extends T> values, java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When an argument is null.java.lang.IllegalArgumentException
- When the values is an empty iterable.public boolean contains(T obj)
public void clear()
public T get()
public boolean isEmpty()
public boolean isFull()
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
iterator
in class CircularBuffer<T>
public boolean put(T obj)
public int size()
public T[] toArray()
public ReifiedList<T> toList()
public java.lang.String toString()
toString
in class CircularBuffer<T>