Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.util
Class ForwardOnlyMapIndex

java.lang.Object
  extended by com.tangosol.util.ForwardOnlyMapIndex

All Implemented Interfaces:
MapIndex

public class ForwardOnlyMapIndex
extends java.lang.Object
implements MapIndex

ForwardOnlyMapIndex is a MapIndex implementation that unlike the SimpleMapIndex maintains only a forward index and not the inverse index. As a result, the content of getIndexContents() is always empty, so this index cannot be used for querying by IndexAwareFilter, with its primary use as a deserialization optimization.

Since:
Coherence 12.1.3
Author:
gg/hr/jh 2014.03.07

Field Summary
protected  BackingMapContext f_ctx
          The context associated with this index.
protected  ValueExtractor f_extractor
          ValueExtractor object that this MapIndex uses to extract an indexable property value from a [converted] value stored in the resource map.
protected  boolean f_fLazy
          The "lazy" flag.
protected  java.util.Map f_mapForward
          Map that contains the index values (forward index).

 

Fields inherited from interface com.tangosol.util.MapIndex
NO_VALUE

 

Constructor Summary
ForwardOnlyMapIndex(ValueExtractor extractor, BackingMapContext ctx, boolean fOnDemand)
          Construct an index for the given map.

 

Method Summary
 void delete(java.util.Map.Entry entry)
          Update this index in response to a remove operation on a cache.
protected  void deleteInternal(java.util.Map.Entry entry)
          Update this index in response to a remove operation on a cache.
 boolean equals(java.lang.Object o)
          Compares the specified object with this index for equality.
 java.lang.Object get(java.lang.Object oKey)
          Using the index information if possible, get the value associated with the specified key.
 java.util.Comparator getComparator()
          Get the Comparator used to sort the index.
 java.util.Map getIndexContents()
          Get the Map that contains the index contents.
 ValueExtractor getValueExtractor()
          Obtain the ValueExtractor object that the MapIndex uses to extract an indexable Object from a value stored in the indexed Map.
 int hashCode()
          Returns the hash code value for this MapIndex.
 void insert(java.util.Map.Entry entry)
          Update this index in response to a insert operation on a cache.
protected  java.util.Map instantiateForwardIndex()
          Instantiate the forward index.
 boolean isOrdered()
          Determine if the MapIndex orders the contents of the indexed information.
 boolean isPartial()
          Determine if indexed information for any entry in the indexed Map has been excluded from this index.
 java.lang.String toString()
          Returns a string representation of this SimpleMapIndex.
 void update(java.util.Map.Entry entry)
          Update this index in response to an update operation on a cache.
protected  void updateInternal(java.util.Map.Entry entry)
          Update this index in response to an update operation on a cache.

 

Field Detail

f_extractor

protected final ValueExtractor f_extractor
ValueExtractor object that this MapIndex uses to extract an indexable property value from a [converted] value stored in the resource map.

f_mapForward

protected final java.util.Map f_mapForward
Map that contains the index values (forward index). The keys of the Map are the keys to the map being indexed and the values are the extracted values. This map is used by the IndexAwareComparators to avoid a conversion and value extraction steps.

f_ctx

protected final BackingMapContext f_ctx
The context associated with this index.

f_fLazy

protected boolean f_fLazy
The "lazy" flag.

Constructor Detail

ForwardOnlyMapIndex

public ForwardOnlyMapIndex(ValueExtractor extractor,
                           BackingMapContext ctx,
                           boolean fOnDemand)
Construct an index for the given map.
Parameters:
extractor - the ValueExtractor that is used to extract an indexed value from a resource map entry
ctx - the context associated with the indexed cache
fOnDemand - if true, the forward index will be created "on-demand" as the values are attempted to be accessed; otherwise the forward index is populated proactively

Method Detail

getValueExtractor

public ValueExtractor getValueExtractor()
Obtain the ValueExtractor object that the MapIndex uses to extract an indexable Object from a value stored in the indexed Map. This property is never null.
Specified by:
getValueExtractor in interface MapIndex
Returns:
a ValueExtractor object, never null

isOrdered

public boolean isOrdered()
Determine if the MapIndex orders the contents of the indexed information. To determine in which way the contents are ordered, get the Comparator from the index contents SortedMap object.
Specified by:
isOrdered in interface MapIndex
Returns:
true if the index contents are ordered, false otherwise

isPartial

public boolean isPartial()
Determine if indexed information for any entry in the indexed Map has been excluded from this index. This information is used for IndexAwareFilter implementations to determine the most optimal way to apply the index.

Note: Queries that use a partial index are allowed not to return entries that are not indexed even though they would match the corresponding filter were they evaluated during the full scan (if there were no index). However, it's not allowable for a query to return entries that do not match the corresponding filter, regardless of their presence in the index.

Specified by:
isPartial in interface MapIndex
Returns:
true if any entry of the indexed Map has been excluded from the index, false otherwise

getComparator

public java.util.Comparator getComparator()
Get the Comparator used to sort the index.
Specified by:
getComparator in interface MapIndex
Returns:
the comparator

getIndexContents

public java.util.Map getIndexContents()
Get the Map that contains the index contents.

The keys of the Map are the return values from the ValueExtractor operating against the indexed Map's values, and for each key, the corresponding value stored in the Map is a Set of keys to the indexed Map.

If the MapIndex is known to be ordered, then the returned Map object will be an instance of SortedMap. The SortedMap may or may not have a Comparator object associated with it; see SortedMap.comparator().

A client should assume that the returned Map object is read-only and must not attempt to modify it.

Specified by:
getIndexContents in interface MapIndex
Returns:
a Map (or a SortedMap) of the index contents

get

public java.lang.Object get(java.lang.Object oKey)
Using the index information if possible, get the value associated with the specified key. This is expected to be more efficient than using the ValueExtractor against an object containing the value, because the index should already have the necessary information at hand.
Specified by:
get in interface MapIndex
Parameters:
oKey - the key that specifies the object to extract the value from
Returns:
the value that would be extracted by this MapIndex's ValueExtractor from the object specified by the passed key; NO_VALUE if the index does not have the necessary information

insert

public void insert(java.util.Map.Entry entry)
Update this index in response to a insert operation on a cache.
Specified by:
insert in interface MapIndex
Parameters:
entry - the entry representing the object being inserted

update

public void update(java.util.Map.Entry entry)
Update this index in response to an update operation on a cache.
Specified by:
update in interface MapIndex
Parameters:
entry - the entry representing the object being updated

delete

public void delete(java.util.Map.Entry entry)
Update this index in response to a remove operation on a cache.
Specified by:
delete in interface MapIndex
Parameters:
entry - the entry representing the object being removed

instantiateForwardIndex

protected java.util.Map instantiateForwardIndex()
Instantiate the forward index.
Returns:
the forward index

updateInternal

protected void updateInternal(java.util.Map.Entry entry)
Update this index in response to an update operation on a cache.
Parameters:
entry - the entry representing the object being updated

deleteInternal

protected void deleteInternal(java.util.Map.Entry entry)
Update this index in response to a remove operation on a cache.
Parameters:
entry - the entry representing the object being removed

toString

public java.lang.String toString()
Returns a string representation of this SimpleMapIndex.
Returns:
a String representation of this SimpleMapIndex

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this index for equality. Returns true if the given object is also a SimpleMapIndex and the two represent the same index.
Parameters:
o - object to be compared for equality with this MapIndex
Returns:
true if the specified object is equal to this index

hashCode

public int hashCode()
Returns the hash code value for this MapIndex.
Returns:
the hash code value for this MapIndex

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


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