V - The value typeclass PersistedValueHolder<V> extends AbstractValueHolder<V>
| Modifier and Type | Field and Description |
|---|---|
private boolean |
isDeserialized
A flag set to true when the raw value has been deserialized
|
private boolean |
isRawUpToDate
A flag to signal that the raw value represent the serialized values in their last state
|
protected static org.slf4j.Logger |
LOG
The LoggerFactory used by this class
|
protected PersistedBTree<V,V> |
parentBtree
The parent BTree
|
private byte[] |
raw
The serialized value
|
nbArrayElems, valueArray, valueBtree, valueSerializer, valueThresholdLow, valueThresholdUp| Constructor and Description |
|---|
PersistedValueHolder(BTree<?,V> parentBtree,
int nbValues,
byte[] raw)
Creates a new instance of a ValueHolder, containing the serialized values.
|
PersistedValueHolder(BTree<?,V> parentBtree,
V... values)
Creates a new instance of a ValueHolder, containing Values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(V value)
Add a new value in the ValueHolder
|
private BTree<V,V> |
build(PersistedBTree<V,V> btree,
V[] dupKeyValues)
Constructs the sub-BTree using bulkload instead of performing sequential inserts.
|
private void |
checkAndDeserialize()
Check that the values are stored as raw value
|
ValueHolder<V> |
clone()
Create a clone of this instance
|
boolean |
contains(V checkedValue)
Tells if a value is contained in this ValueHolder
|
protected void |
createSubTree()
Create a new Sub-BTree to store the values.
|
private void |
deserializeArray()
Deserialize the values stored in an array
|
private void |
deserializeSubBtree()
Deserialize the values stored in a sub-btree
|
private int |
findPos(V value)
Find the position of a given value in the array, or the position where we
would insert the element (in this case, the position will be negative).
|
ValueCursor<V> |
getCursor() |
(package private) long |
getOffset() |
(package private) byte[] |
getRaw() |
protected void |
manageSubTree()
Push the sub-BTree into the RecordManager
|
V |
remove(V value) |
private V |
removeFromArray(V value)
Remove a value from an array
|
private V |
removeFromBtree(V removedValue)
Remove the value from a sub btree
|
V |
replaceValueArray(V newValue)
Replaces the single value present in the array.
|
(package private) void |
setSubBtree(BTree<V,V> subBtree)
Set the subBtree in the ValueHolder
|
int |
size() |
java.lang.String |
toString() |
btreeContains, isSubBtreeprotected static final org.slf4j.Logger LOG
protected PersistedBTree<V,V> parentBtree
private byte[] raw
private boolean isDeserialized
private boolean isRawUpToDate
PersistedValueHolder(BTree<?,V> parentBtree, int nbValues, byte[] raw)
parentBtree - the parent BTreeraw - The raw data containing the valuesnbValues - the number of stored valuesraw - the byte[] containing either the serialized array of values or the sub-btree offsetPersistedValueHolder(BTree<?,V> parentBtree, V... values)
parentBtree - The parent BTreevalues - The Values stored in the ValueHolderpublic ValueCursor<V> getCursor()
getCursor in interface ValueHolder<V>getCursor in class AbstractValueHolder<V>byte[] getRaw()
public int size()
protected void createSubTree()
createSubTree in class AbstractValueHolder<V>protected void manageSubTree()
manageSubTree in class AbstractValueHolder<V>private void checkAndDeserialize()
public void add(V value)
add in interface ValueHolder<V>add in class AbstractValueHolder<V>value - The added valuepublic boolean contains(V checkedValue)
contains in interface ValueHolder<V>contains in class AbstractValueHolder<V>checkedValue - The added to checkprivate int findPos(V value)
public ValueHolder<V> clone() throws java.lang.CloneNotSupportedException
clone in interface ValueHolder<V>clone in class AbstractValueHolder<V>java.lang.CloneNotSupportedException - If we can't clone this instancepublic V replaceValueArray(V newValue)
AbstractValueHolderreplaceValueArray in interface ValueHolder<V>replaceValueArray in class AbstractValueHolder<V>newValue - the new valueprivate void deserializeArray()
private void deserializeSubBtree()
long getOffset()
private BTree<V,V> build(PersistedBTree<V,V> btree, V[] dupKeyValues) throws java.lang.Exception
btree - the sub-BTtree to be constructeddupKeyValues - the array of values to be inserted as keysjava.lang.Exceptionpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()