Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

ConditionalIndex Class Reference

#include <coherence/util/ConditionalIndex.hpp>

Inherits SimpleMapIndex.

List of all members.


Detailed Description

ConditionalIndex is a conherence::util::MapIndex implementation that uses an associated filter to evaluate whether or not an entry should be indexed.

An entry's extracted value is only added to the index if the filter evaluates to true.

Author:
tb/lh 2010.08.31
Since:
Coherence 3.6.1
 

Public Types

typedef spec::Handle Handle
 ConditionalIndex Handle definition.
typedef spec::View View
 ConditionalIndex View definition.
typedef spec::Holder Holder
 ConditionalIndex Holder definition.

Public Member Functions

virtual Object::Holder get (Object::View vKey) const
 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.

Parameters:
 vKey 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; getNoValue() if the index does not have the necessary information
virtual Object::Holder get (Object::View vKey)
 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.

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
virtual bool isPartial () const
 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.

Returns:
true if any entry of the indexed Map has been excluded from the index, false otherwise
Since:
Coherence 3.6
Filter::View getFilter () const
 Get the associated filter.
bool isForwardIndexSupported () const
 Determine whether or not this ConditionalIndex supports a forward index.
virtual void toStream (std::ostream &out) const
 Writes a string representation of this ConditionalIndex to the stream.
virtual bool equals (Object::View v) const
 Compares the specified object with this index for equality.

Protected Member Functions

 ConditionalIndex (Filter::View vFilter, ValueExtractor::View vExtractor, bool fOrdered, Comparator::View vComparator, bool fForwardIndex)
 Construct a ConditionalIndex.
virtual Map::Entry::View getForwardEntry (Object::View vKey) const
 Get the forward index entry associated with the specified key.

Parameters:
 vKey the key
Returns:
the entry associated with the given key.
virtual
Map::Entry::Handle 
getForwardEntry (Object::View vKey)
 Get the forward index entry associated with the specified key.

Parameters:
 vKey the key
Returns:
the entry associated with the given key.
Map::Handle instantiateForwardIndex () const
 Instantiate and initialize the forward index.

Note: To optimize the memory footprint of the forward index, any subclasses of the SimpleMapIndex that override this method must also implement the getForwardEntry(Object) method accordingly.

Returns:
the forward index.
bool evaluateEntry (Map::Entry::View vEntry)
 Evaluate the given entry using this index's filter.
virtual void insertInternal (Map::Entry::View vEntry)
 Update this index in response to a insert operation on a cache.

Parameters:
 vEntry the entry representing the object being inserted
virtual void updateInternal (Map::Entry::View vEntry)
 Update this index in response to an update operation on a cache.

Parameters:
 vEntry the entry representing the object being updated
virtual void removeInternal (Map::Entry::View vEntry)
 Update this index in response to a remove operation on a cache.

Parameters:
 vEntry the entry representing the object being removed

Constructor & Destructor Documentation

ConditionalIndex ( Filter::View  vFilter,
    ValueExtractor::View  vExtractor,
    bool  fOrdered,
    Comparator::View  vComparator,
    bool  fForwardIndex 
  )    [protected]

Construct a ConditionalIndex.

Parameters:
 vFilter the filter that is used to evaluate the entries of the resource map that is being indexed
 vExtractor the coherence::util::ValueExtractor that is used to extract an indexed value from a resource map entry
 fOrdered true iff the contents of the indexed information should be ordered; false otherwise
 vComparator the Comparator object which imposes an ordering on entries in the index map; or null if the entries' values natural ordering should be used
 fForwardIndex specifies whether or not this index supports a forward map


Member Function Documentation

Filter::View getFilter (  )  const

Get the associated filter.

Returns:
the filter

bool isForwardIndexSupported (  )  const

Determine whether or not this ConditionalIndex supports a forward index.

Returns:
true if this ConditionalIndex supports a forward index; false otherwise

bool evaluateEntry ( Map::Entry::View  vEntry  )  [protected]

Evaluate the given entry using this index's filter.

If the entry does not pass the filter then it should be excluded from this index, making this a partial index.

Parameters:
 vEntry the entry to evaluate
Returns:
true if the entry passes the filter; false otherwise

virtual void toStream ( std::ostream &  out  )  const [virtual]

Writes a string representation of this ConditionalIndex to the stream.

The string representation consists of the SimpleMapIndex representaion concatenated by the Filter and the ForwardIndexSupported flag.

Reimplemented from SimpleMapIndex.

virtual bool equals ( Object::View  v  )  const [virtual]

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

Reimplemented from SimpleMapIndex.


The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.