|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.relation.accesspath.AbstractUnsynchronizedArrayBuffer<E>
public abstract class AbstractUnsynchronizedArrayBuffer<E>
An abstract implementation of an unsynchronized buffer backed by a fixed capacity array.
This implementation is NOT thread-safe.
| Constructor Summary | |
|---|---|
AbstractUnsynchronizedArrayBuffer(int capacity,
Class<? extends E> cls)
|
|
AbstractUnsynchronizedArrayBuffer(int capacity,
Class<? extends E> cls,
IElementFilter<E> filter)
|
|
| Method Summary | |
|---|---|
protected boolean |
accept(E e)
Applies the optional filter to restrict elements allowed into the buffer. |
void |
add(E e)
Not thread-safe. |
boolean |
add2(E e)
Adds an element to the buffer. |
long |
flush()
Flush the buffer and return the #of elements written on the backing IRelation since the counter was last IBuffer.reset() (the
mutationCount). |
protected abstract void |
handleChunk(E[] chunk)
Dispatch a chunk. |
boolean |
isEmpty()
If size() reports zero(0). |
protected void |
overflow()
Adds all references in the internal buffer to the target buffer, resets the #of elements in the internal buffer to ZERO (0), and clears the internal array - it will be reallocated again on demand. |
void |
reset()
Reset the state of the buffer, including the counter whose value is reported by IBuffer.flush(). |
int |
size()
The exact #of elements currently in the buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractUnsynchronizedArrayBuffer(int capacity,
Class<? extends E> cls)
capacity - The capacity of the backing buffer.cls - The component type for the backing array.
public AbstractUnsynchronizedArrayBuffer(int capacity,
Class<? extends E> cls,
IElementFilter<E> filter)
capacity - The capacity of the backing buffer.cls - The component type for the backing array.filter - Filter to keep elements out of the buffer (optional).| Method Detail |
|---|
public final boolean isEmpty()
size() reports zero(0).
isEmpty in interface IBuffer<E>public final int size()
size in interface IBuffer<E>protected boolean accept(E e)
e - A element.
public final void add(E e)
add in interface IBuffer<E>e - The elementpublic boolean add2(E e)
e - An element.
true iff adding the element caused the buffer to
overflow()protected void overflow()
protected abstract void handleChunk(E[] chunk)
chunk - A chunk.public long flush()
IBufferIRelation since the counter was last IBuffer.reset() (the
mutationCount).
Note: If the buffer does not write on an IRelation then it SHOULD
return ZERO(0).
flush in interface IBuffer<E>IRelation.
See IMutableRelationpublic void reset()
IBufferIBuffer.flush(). Any data in the buffer will be discarded.
reset in interface IBuffer<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||