com.bigdata.relation.accesspath
Class UnsynchronizedUnboundedChunkBuffer<E>

java.lang.Object
  extended by com.bigdata.relation.accesspath.AbstractUnsynchronizedArrayBuffer<E>
      extended by com.bigdata.relation.accesspath.UnsynchronizedUnboundedChunkBuffer<E>
All Implemented Interfaces:
IBuffer<E>

public class UnsynchronizedUnboundedChunkBuffer<E>
extends AbstractUnsynchronizedArrayBuffer<E>

An unsynchronized buffer backed by a fixed capacity array that migrates references onto an internal Queue, which may be drained by an iterator().

This implementation is NOT thread-safe.

Version:
$Id: UnsynchronizedUnboundedChunkBuffer.java 6130 2012-03-15 10:31:25Z thompsonbry $
Author:
Bryan Thompson
See Also:
TestUnsynchronizedUnboundedChunkBuffer

Constructor Summary
UnsynchronizedUnboundedChunkBuffer(int capacity, Class<? extends E> cls)
           
UnsynchronizedUnboundedChunkBuffer(int capacity, Class<? extends E> cls, IElementFilter<E> filter, IKeyOrder<E> keyOrder)
           
 
Method Summary
protected  void handleChunk(E[] chunk)
          Add the chunk to the target buffer.
 IChunkedOrderedIterator<E> iterator()
          Iterator drains chunks from a snapshot of the queue (shallow copy).
 
Methods inherited from class com.bigdata.relation.accesspath.AbstractUnsynchronizedArrayBuffer
accept, add, add2, flush, isEmpty, overflow, reset, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnsynchronizedUnboundedChunkBuffer

public UnsynchronizedUnboundedChunkBuffer(int capacity,
                                          Class<? extends E> cls)
Parameters:
capacity - The capacity of the backing buffer.
cls - The component type of the backing array.

UnsynchronizedUnboundedChunkBuffer

public UnsynchronizedUnboundedChunkBuffer(int capacity,
                                          Class<? extends E> cls,
                                          IElementFilter<E> filter,
                                          IKeyOrder<E> keyOrder)
Parameters:
capacity - The capacity of the backing buffer.
cls - The component type of the backing array.
filter - Filter to keep elements out of the buffer (optional).
keyOrder - The order of the elements in the chunks written onto the buffer or null iff not known.
Method Detail

handleChunk

protected final void handleChunk(E[] chunk)
Add the chunk to the target buffer.

Specified by:
handleChunk in class AbstractUnsynchronizedArrayBuffer<E>
Parameters:
chunk - A chunk.

iterator

public IChunkedOrderedIterator<E> iterator()
Iterator drains chunks from a snapshot of the queue (shallow copy). Chunks are drained in a FIFO basis. The internal buffer is flushed onto a chunk on the queue before the snapshot is taken so that any buffered elements will appear in the snapshot.



Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.