com.bigdata.btree.raba
Class MutableValuesRaba

java.lang.Object
  extended by com.bigdata.btree.raba.AbstractRaba
      extended by com.bigdata.btree.raba.MutableValuesRaba
All Implemented Interfaces:
IRaba, Iterable<byte[]>

public class MutableValuesRaba
extends AbstractRaba
implements IRaba

Flyweight implementation for wrapping a byte[][] with fromIndex and toIndex.

Version:
$Id: MutableValuesRaba.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
See Also:
MutableValueBuffer

Field Summary
 
Fields inherited from class com.bigdata.btree.raba.AbstractRaba
a, capacity, fromIndex, toIndex
 
Constructor Summary
MutableValuesRaba(byte[][] a)
          Create a view of a byte[][].
MutableValuesRaba(int fromIndex, int toIndex, byte[][] a)
          Create a view of a byte[][] slice.
MutableValuesRaba(int fromIndex, int toIndex, int capacity, byte[][] a)
          Create a view from a slice of a byte[][].
 
Method Summary
 boolean isKeys()
          No.
 boolean isReadOnly()
          No - This view is mutable.
 MutableValuesRaba resize(int n)
          Resize the buffer, copying up to n references to the existing data into a new view backed by a new byte[][].
 
Methods inherited from class com.bigdata.btree.raba.AbstractRaba
add, add, add, assertNotFull, assertNotReadOnly, assertNullAllowed, capacity, copy, get, isEmpty, isFull, isNull, iterator, length, rangeCheck, search, set, size, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.btree.raba.IRaba
add, add, add, capacity, copy, get, isEmpty, isFull, isNull, iterator, length, search, set, size
 

Constructor Detail

MutableValuesRaba

public MutableValuesRaba(byte[][] a)
Create a view of a byte[][]. All elements in the array are visible in the view.

Parameters:
a - The backing byte[][].

MutableValuesRaba

public MutableValuesRaba(int fromIndex,
                         int toIndex,
                         byte[][] a)
Create a view of a byte[][] slice. The slice will include only those elements between the fromIndex and the toIndex. The capacity will be the #of elements. AbstractRaba.isFull() will report true .

Parameters:
fromIndex - The index of the first visible in the view (inclusive lower bound).
toIndex - The index of the first element beyond the view (exclusive upper bound). If toIndex == fromIndex then the view is empty.
a - The backing byte[][].

MutableValuesRaba

public MutableValuesRaba(int fromIndex,
                         int toIndex,
                         int capacity,
                         byte[][] a)
Create a view from a slice of a byte[][].

Parameters:
fromIndex - The index of the first element in the byte[][] which is visible in the view (inclusive lower bound).
toIndex - The index of the first element in the byte[][] beyond the view (exclusive upper bound).
capacity - The #of elements which may be used in the view.
a - The backing byte[][].
Method Detail

isReadOnly

public boolean isReadOnly()
No - This view is mutable.

Specified by:
isReadOnly in interface IRaba

isKeys

public final boolean isKeys()
No.

Specified by:
isKeys in interface IRaba
Returns:
true if the IRaba represents B+Tree keys and false if it represents B+Tree values.

resize

public MutableValuesRaba resize(int n)
Description copied from class: AbstractRaba
Resize the buffer, copying up to n references to the existing data into a new view backed by a new byte[][]. fromIndex will be zero in the new view.

This method requires a public constructor with the following signature:

 ctor(byte[][])
 

Overrides:
resize in class AbstractRaba
Parameters:
n - The size of the new buffer.
Returns:
The new view, backed by a new byte[][].


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