com.sleepycat.je.tree
Class INKeyRep.Default

java.lang.Object
  extended by com.sleepycat.je.tree.INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
      extended by com.sleepycat.je.tree.INKeyRep
          extended by com.sleepycat.je.tree.INKeyRep.Default
Enclosing class:
INKeyRep

public static class INKeyRep.Default
extends INKeyRep

The default representation that's capable of storing keys of any size.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sleepycat.je.tree.INKeyRep
INKeyRep.Default, INKeyRep.MaxKeySize, INKeyRep.Type
 
Constructor Summary
INKeyRep.Default(int nodeMaxEntries)
           
INKeyRep.Default(SizeofMarker marker)
           
 
Method Summary
 boolean accountsForKeyByteMemUsage()
          Returns true if the key bytes mem usage is accounted for internally here, or false if each key has a separate byte array and its mem usage is accounted for by the parent.
 long calculateMemorySize()
          Returns the current memory size of the underlying representation in bytes.
 INKeyRep compact(IN parent)
          Evolves to the MaxKeySize representation if that is more efficient for the current set of keys.
 INKeyRep copy(int from, int to, int n, IN parent)
          Copies n elements at index denoted by "from" to the index denoted by "to".
 byte[] get(int idx)
          Returns the element at idx.
 INKeyRep.Type getType()
           
 int length()
           
 INKeyRep set(int idx, byte[] key, IN parent)
          Sets the array element at idx to the node.
(package private)  void updateCacheStats(boolean increment, Evictor evictor)
          Update the cache statistics for this representation.
 
Methods inherited from class com.sleepycat.je.tree.INArrayRep
noteRepChange, updateCacheStats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

INKeyRep.Default

INKeyRep.Default(int nodeMaxEntries)

INKeyRep.Default

public INKeyRep.Default(SizeofMarker marker)
Method Detail

getType

public INKeyRep.Type getType()
Specified by:
getType in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>

get

public byte[] get(int idx)
Description copied from class: INArrayRep
Returns the element at idx.

Specified by:
get in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>

set

public INKeyRep set(int idx,
                    byte[] key,
                    IN parent)
Description copied from class: INArrayRep
Sets the array element at idx to the node. The underlying representation can change as a result of the set operation.

Specified by:
set in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
Parameters:
idx - the index to be set
key - the array elelement at the idx
Returns:
either this, or the new representation if there was a mutation.

copy

public INKeyRep copy(int from,
                     int to,
                     int n,
                     IN parent)
Description copied from class: INArrayRep
Copies n elements at index denoted by "from" to the index denoted by "to". Overlapping copies are supported. It's possible that the representation may mutate as a result of the copy.

Specified by:
copy in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
Parameters:
from - the source (inclusive) of the copy
to - the target (inclusive) of the copy
n - the number of elements to be copied.
Returns:
either this, or the new representation if there was a mutation.

calculateMemorySize

public long calculateMemorySize()
Description copied from class: INArrayRep
Returns the current memory size of the underlying representation in bytes. It returns the size of the representation, excluding the size of the elements contained in it.

Specified by:
calculateMemorySize in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
Returns:
the memory size of the representation in bytes

compact

public INKeyRep compact(IN parent)
Evolves to the MaxKeySize representation if that is more efficient for the current set of keys. Note that since all the keys must be examined to make the decision, there is a reasonable cost to the method and it should not be invoked indiscriminately.

Specified by:
compact in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
Returns:
this or a more compact representation.

length

public int length()
Specified by:
length in class INKeyRep

accountsForKeyByteMemUsage

public boolean accountsForKeyByteMemUsage()
Description copied from class: INKeyRep
Returns true if the key bytes mem usage is accounted for internally here, or false if each key has a separate byte array and its mem usage is accounted for by the parent.

Specified by:
accountsForKeyByteMemUsage in class INKeyRep

updateCacheStats

void updateCacheStats(boolean increment,
                      Evictor evictor)
Description copied from class: INArrayRep
Update the cache statistics for this representation.

Specified by:
updateCacheStats in class INArrayRep<INKeyRep,INKeyRep.Type,byte[]>
Parameters:
increment - true the stat should be incremented, false if it must be decremented
evictor - the evictor that shoulds ths stat counters
See Also:
#updateCacheStats(boolean)


Copyright (c) 2004-2012 Oracle. All rights reserved.