com.sleepycat.je.tree
Class INTargetRep.Sparse

java.lang.Object
  extended by com.sleepycat.je.tree.INArrayRep<INTargetRep,INTargetRep.Type,Node>
      extended by com.sleepycat.je.tree.INTargetRep
          extended by com.sleepycat.je.tree.INTargetRep.Sparse
Enclosing class:
INTargetRep

public static class INTargetRep.Sparse
extends INTargetRep

Representation used when 1-4 children are cached. Note that the IN itself may have more children, but they are not currently cached. The INArrayRep is represented by two parallel arrays: an array of indices (idxs) and an array of values (targets). All elements that are not explicitly represented are null.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sleepycat.je.tree.INTargetRep
INTargetRep.Default, INTargetRep.None, INTargetRep.Sparse, INTargetRep.Type
 
Field Summary
(package private)  short[] idxs
           
static int MAX_ENTRIES
           
static int MAX_INDEX
           
(package private)  int nodeMaxEntries
           
(package private)  Node[] targets
           
 
Fields inherited from class com.sleepycat.je.tree.INArrayRep
parent
 
Constructor Summary
INTargetRep.Sparse(IN parent, int capacity)
           
INTargetRep.Sparse(SizeofMarker marker)
           
 
Method Summary
 long calculateMemorySize()
          Returns the current memory size of the underlying representation in bytes.
 INTargetRep compact()
          Chooses a more compact representation, if that's possible, otherwise does nothing.
 INTargetRep copy(int from, int to, int n)
          Copies n elements at index denoted by "from" to the index denoted by "to".
 Node get(int j)
          Returns the element at idx.
 INTargetRep.Type getType()
           
 int length()
          Returns the length, that is, the range within which get and set operations can be performed.
 INTargetRep set(int j, Node node)
          Sets the array element at idx to the node.
 void updateCacheStats(boolean increment, Evictor evictor)
          Update the cache statistics for this representation.
 
Methods inherited from class com.sleepycat.je.tree.INArrayRep
noteRepChange, noteRepChange, updateCacheStats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ENTRIES

public static final int MAX_ENTRIES
See Also:
Constant Field Values

MAX_INDEX

public static final int MAX_INDEX
See Also:
Constant Field Values

nodeMaxEntries

final int nodeMaxEntries

idxs

final short[] idxs

targets

final Node[] targets
Constructor Detail

INTargetRep.Sparse

public INTargetRep.Sparse(IN parent,
                          int capacity)

INTargetRep.Sparse

public INTargetRep.Sparse(SizeofMarker marker)
Method Detail

getType

public INTargetRep.Type getType()
Specified by:
getType in class INArrayRep<INTargetRep,INTargetRep.Type,Node>

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<INTargetRep,INTargetRep.Type,Node>
Returns:
the memory size of the representation in bytes

copy

public INTargetRep copy(int from,
                        int to,
                        int n)
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<INTargetRep,INTargetRep.Type,Node>
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.

get

public Node get(int j)
Description copied from class: INArrayRep
Returns the element at idx.

Specified by:
get in class INArrayRep<INTargetRep,INTargetRep.Type,Node>

length

public int length()
Description copied from class: INArrayRep
Returns the length, that is, the range within which get and set operations can be performed.

Specified by:
length in class INArrayRep<INTargetRep,INTargetRep.Type,Node>

set

public INTargetRep set(int j,
                       Node node)
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<INTargetRep,INTargetRep.Type,Node>
Parameters:
j - the index to be set
node - the array elelement at the idx
Returns:
either this, or the new representation if there was a mutation.

compact

public INTargetRep compact()
Description copied from class: INArrayRep
Chooses a more compact representation, if that's possible, otherwise does nothing.

Specified by:
compact in class INArrayRep<INTargetRep,INTargetRep.Type,Node>
Returns:
this or a more compact representation.

updateCacheStats

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

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


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