Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class SafeSortedMap.Split

java.lang.Object
  extended by com.tangosol.util.SafeSortedMap.Split

Enclosing class:
SafeSortedMap

public class SafeSortedMap.Split
extends java.lang.Object

Split encapsulates the headMap and tailMap of the SafeSortedMap at a given split-key and could be used as an optimization facility when both head and tail portions of the SortedMap are needed.


Field Summary
protected  float m_flHeadWeight
          The estimated weight of the head portion of the split, expressed as a ratio of the size of the headMap to the size of the underlying SafeSortedMap.
protected  java.util.SortedMap m_mapHead
          The headMap.
protected  java.util.SortedMap m_mapTail
          The tailMap.

 

Constructor Summary
protected SafeSortedMap.Split(java.lang.Object oKey)
          Construct a split at the specified key.

 

Method Summary
protected  float calculateHeadWeight()
          Estimate the weight of the head portion of the Split.
 java.util.SortedMap getHead()
          Return front of the split.
 float getHeadWeight()
          Return the estimated weight of the head portion of the SafeSortedMap.Split.
 java.lang.Object getSplitKey()
          Return the key around which this is SafeSortedMap.Split is defined.
 java.util.SortedMap getTail()
          Return tail of the split
 float getTailWeight()
          Return the estimated weight of the tail portion of the SafeSortedMap.Split.
 boolean isHeadHeavy()
          Return true if the estimated weight of the head of the split is larger than the tail.
protected  int quickLog(int n, int nBase)
          Calculate and return the floor of lognBase(n).

 

Field Detail

m_mapHead

protected java.util.SortedMap m_mapHead
The headMap.

m_mapTail

protected java.util.SortedMap m_mapTail
The tailMap.

m_flHeadWeight

protected float m_flHeadWeight
The estimated weight of the head portion of the split, expressed as a ratio of the size of the headMap to the size of the underlying SafeSortedMap.

Constructor Detail

SafeSortedMap.Split

protected SafeSortedMap.Split(java.lang.Object oKey)
Construct a split at the specified key.
Parameters:
oKey - the key at which to split

Method Detail

quickLog

protected int quickLog(int n,
                       int nBase)
Calculate and return the floor of lognBase(n).
Parameters:
n - the number to take the logarithm of
nBase - the base with which to compute the logarithm
Returns:
the floor of lognBase(n)

calculateHeadWeight

protected float calculateHeadWeight()
Estimate the weight of the head portion of the Split. The weight is expressed as a ratio of the size of the headMap to the size of the underlying SafeSortedMap.
Returns:
the estimated weight of the head portion of the Split

getHead

public java.util.SortedMap getHead()
Return front of the split. This is a SortedMap view of
Returns:
the front of the split

getTail

public java.util.SortedMap getTail()
Return tail of the split
Returns:
the tail of the split

getHeadWeight

public float getHeadWeight()
Return the estimated weight of the head portion of the SafeSortedMap.Split. The weight is expressed as a ratio of the size of the headMap to the size of the underlying SafeSortedMap.

Note: this method is not guaranteed to return an exact answer, but rather uses a heuristic to make an estimate. For an exact answer, the more expensive size() methods should be used.

Returns:
the estimated weight of the head portion of the split

getTailWeight

public float getTailWeight()
Return the estimated weight of the tail portion of the SafeSortedMap.Split. The weight is expressed as a ratio of the size of the tailMap to the size of the underlying SafeSortedMap.

Note: this method is not guaranteed to return an exact answer, but rather uses a heuristic to make an estimate. For an exact answer, the more expensive size() methods should be used.

Returns:
the estimated weight of the tail portion of the split

isHeadHeavy

public boolean isHeadHeavy()
Return true if the estimated weight of the head of the split is larger than the tail.
Returns:
true iff the estimated weight of the head of the split is larger than the tail
See Also:
getHeadWeight()

getSplitKey

public java.lang.Object getSplitKey()
Return the key around which this is SafeSortedMap.Split is defined.
Returns:
the key around which this is SafeSortedMap.Split is defined

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.