com.bigdata.btree.keys
Class KVO<O>

java.lang.Object
  extended by com.bigdata.btree.keys.KVO<O>
Type Parameters:
O - The generic type of the unserialized value object.
All Implemented Interfaces:
Comparable<KVO<O>>
Direct Known Subclasses:
KV, KVOList

public class KVO<O>
extends Object
implements Comparable<KVO<O>>

A key-value-object tuple. Comparison places the KVO tuples into an order based on the interpretation of their keys as unsigned byte[]s. This may be used to perform a correlated sort of keys and values. This class may also be used to pair an optional unserialized representation of the value Object with the unsigned byte[] key and the serialized byte[] value.

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

Field Summary
 byte[] key
          The unsigned byte[] key (required).
 O obj
          The unserialized object value (optional, even when val is given).
 byte[] val
          The serialized byte[] value (optional).
 
Constructor Summary
KVO(byte[] key, byte[] val)
           
KVO(byte[] key, byte[] val, O obj)
           
 
Method Summary
 int compareTo(KVO<O> arg0)
           
static
<T> KVO<T>[]
dense(KVO<T>[] a, int len)
          Return a dense array.
 void done()
          Method is invoked when the tuple represented by the KVO has been written onto the index by an asynchronous write operation.
static byte[][] getKeys(KVO<?>[] chunk)
          Return a dense array of the keys in a KVO[] chunk.
static byte[][] getVals(KVO<?>[] chunk)
          Return a dense array of the values in a KVO[] chunk.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

public final byte[] key
The unsigned byte[] key (required).


val

public final byte[] val
The serialized byte[] value (optional).


obj

public final O obj
The unserialized object value (optional, even when val is given).

Constructor Detail

KVO

public KVO(byte[] key,
           byte[] val)
Parameters:
key - The unsigned byte[] key (required).
val - The serialized byte[] value (optional).

KVO

public KVO(byte[] key,
           byte[] val,
           O obj)
Parameters:
key - The unsigned byte[] key (required).
val - The serialized byte[] value (optional).
obj - The unserialized object value (optional, even when val is given).
Method Detail

done

public void done()
Method is invoked when the tuple represented by the KVO has been written onto the index by an asynchronous write operation. KVOC overrides this method to support notification when all tuples generated within some scope have been written onto the database.


compareTo

public int compareTo(KVO<O> arg0)
Specified by:
compareTo in interface Comparable<KVO<O>>

toString

public String toString()
Overrides:
toString in class Object

getKeys

public static byte[][] getKeys(KVO<?>[] chunk)
Return a dense array of the keys in a KVO[] chunk. The keys are copied by reference, not by value.

Parameters:
chunk - A chunk of KVO objects.
Returns:
The keys.

getVals

public static byte[][] getVals(KVO<?>[] chunk)
Return a dense array of the values in a KVO[] chunk. The values are copied by reference, not by value.

Parameters:
chunk - A chunk of KVO objects.
Returns:
The values.

dense

public static <T> KVO<T>[] dense(KVO<T>[] a,
                                 int len)
Return a dense array. If the array is already dense, then the array reference is returned. This is not a deep copy.

Parameters:
a - The array.
len - The #of elements in the array [0:len-1].
Returns:
A dense array.


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