com.bigdata.btree
Class DelegateTuple<E>

java.lang.Object
  extended by com.bigdata.btree.DelegateTuple<E>
All Implemented Interfaces:
ITuple<E>

public class DelegateTuple<E>
extends Object
implements ITuple<E>

An ITuple wrapping a delegate that may be used to override some of the methods on the delegate object.

Version:
$Id: DelegateTuple.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected  ITuple<E> delegate
           
 
Constructor Summary
DelegateTuple(ITuple<E> delegate)
           
 
Method Summary
 int flags()
          The IRangeQuery flags
 byte[] getKey()
          Returns a copy of the current key.
 ByteArrayBuffer getKeyBuffer()
          The buffer into which the keys are being copied.
 boolean getKeysRequested()
          True iff IRangeQuery.KEYS was specified.
 DataInputBuffer getKeyStream()
          Return a stream from which the key may be read.
 E getObject()
          De-serializes the object from the key and/or value.
 int getSourceIndex()
          The index of the source from which the tuple was read.
 ITupleSerializer getTupleSerializer()
          Return the object that can be used to de-serialize the tuple.
 byte[] getValue()
          The value in the index under the key.
 ByteArrayBuffer getValueBuffer()
          The buffer into which the values are being copied.
 boolean getValuesRequested()
          True iff IRangeQuery.VALS was specified.
 DataInputBuffer getValueStream()
          Return a stream from which the value may be read.
 long getVersionTimestamp()
          Return the timestamp associated with the index entry -or- 0L IFF the index does not support transactional isolation.
 long getVisitCount()
          The #of entries that have been visited so far and ZERO (0) until the first entry has been visited.
 boolean isDeletedVersion()
          Return true iff the index entry was marked as deleted.
 boolean isNull()
          true iff the value stored under the index entry is null.
 IBlock readBlock(long addr)
          Return an object that may be used to perform a streaming read of a large record from the IRawStore that provided this tuple.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

protected final ITuple<E> delegate
Constructor Detail

DelegateTuple

public DelegateTuple(ITuple<E> delegate)
Method Detail

getSourceIndex

public int getSourceIndex()
Description copied from interface: ITuple
The index of the source from which the tuple was read. This is zero (0) if there is only a single source, e.g., a BTree or IndexSegment. When reading on a FusedView this is the index of the element of the view which reported the tuple.

Specified by:
getSourceIndex in interface ITuple<E>

flags

public int flags()
Description copied from interface: ITuple
The IRangeQuery flags
 
 if ((flags & IRangeQuery.KEYS) != 0) {
 
     // keys requested.
 
 }
 
 
Note: the IRangeQuery.DELETED flag state is a property of the iterator NOT the tuple. Whether or not a tuple is deleted is detected using ITuple.isDeletedVersion().

Specified by:
flags in interface ITuple<E>

getKey

public byte[] getKey()
Description copied from interface: ITuple
Returns a copy of the current key.

Note: This can cause a heap allocation depending on how the keys are buffered. See ITuple.getKeyBuffer() to avoid that allocation.

Specified by:
getKey in interface ITuple<E>

getKeyBuffer

public ByteArrayBuffer getKeyBuffer()
Description copied from interface: ITuple
The buffer into which the keys are being copied.

Specified by:
getKeyBuffer in interface ITuple<E>
Returns:
The buffer.

getKeysRequested

public boolean getKeysRequested()
Description copied from interface: ITuple
True iff IRangeQuery.KEYS was specified.

Specified by:
getKeysRequested in interface ITuple<E>

getKeyStream

public DataInputBuffer getKeyStream()
Description copied from interface: ITuple
Return a stream from which the key may be read.

Specified by:
getKeyStream in interface ITuple<E>

getValue

public byte[] getValue()
Description copied from interface: ITuple
The value in the index under the key.

Note: This causes a heap allocation. See ITuple.getValueBuffer() to avoid that allocation.

Specified by:
getValue in interface ITuple<E>
Returns:
The value in the index under the key -or- null if version metadata is being maintained and the the index entry is marked as deleted.

isNull

public boolean isNull()
Description copied from interface: ITuple
true iff the value stored under the index entry is null.

Specified by:
isNull in interface ITuple<E>

getValueBuffer

public ByteArrayBuffer getValueBuffer()
Description copied from interface: ITuple
The buffer into which the values are being copied.

Note: If the index supports delete markers then you MUST test ITuple.isDeletedVersion() in order to determine whether or not the value buffer contains data for the current index entry.

Specified by:
getValueBuffer in interface ITuple<E>
Returns:
The buffer.

getValuesRequested

public boolean getValuesRequested()
Description copied from interface: ITuple
True iff IRangeQuery.VALS was specified.

Specified by:
getValuesRequested in interface ITuple<E>

getValueStream

public DataInputBuffer getValueStream()
Description copied from interface: ITuple
Return a stream from which the value may be read. Callers SHOULD prefer ITuple.getValueStream() to ITuple.getValue() as it can avoid some heap churn.

Specified by:
getValueStream in interface ITuple<E>

getVersionTimestamp

public long getVersionTimestamp()
Description copied from interface: ITuple
Return the timestamp associated with the index entry -or- 0L IFF the index does not support transactional isolation.

Specified by:
getVersionTimestamp in interface ITuple<E>

getVisitCount

public long getVisitCount()
Description copied from interface: ITuple
The #of entries that have been visited so far and ZERO (0) until the first entry has been visited.

Specified by:
getVisitCount in interface ITuple<E>

isDeletedVersion

public boolean isDeletedVersion()
Description copied from interface: ITuple
Return true iff the index entry was marked as deleted.

Note: If the index does not support deletion markers then this method MUST return false.

Note: the IRangeQuery.DELETED flag state is a property of the iterator NOT the tuple. Whether or not a tuple is deleted is detected using ITuple.isDeletedVersion().

Specified by:
isDeletedVersion in interface ITuple<E>

toString

public String toString()
Overrides:
toString in class Object

readBlock

public IBlock readBlock(long addr)
Description copied from interface: ITuple
Return an object that may be used to perform a streaming read of a large record from the IRawStore that provided this tuple.

Specified by:
readBlock in interface ITuple<E>
Parameters:
addr - The address of the record.
Returns:
The object that may be used to read that record.

getObject

public E getObject()
Description copied from interface: ITuple
De-serializes the object from the key and/or value.

Specified by:
getObject in interface ITuple<E>
Returns:
The de-serialized object.
See Also:
ITupleSerializer.deserialize(ITuple)

getTupleSerializer

public ITupleSerializer getTupleSerializer()
Description copied from interface: ITuple
Return the object that can be used to de-serialize the tuple.

Specified by:
getTupleSerializer in interface ITuple<E>


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