Package com.tangosol.util
Class ConditionalIndex
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.SimpleMapIndex
com.tangosol.util.ConditionalIndex
- All Implemented Interfaces:
- MapIndex
ConditionalIndex is a 
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.- Since:
- Coherence 3.6
- Author:
- tb 2010.02.08
- 
Nested Class SummaryNested classes/interfaces inherited from class com.tangosol.util.SimpleMapIndexSimpleMapIndex.IndexCalculatorNested classes/interfaces inherited from class com.tangosol.util.BaseBase.LoggingWriter
- 
Field SummaryFields inherited from class com.tangosol.util.SimpleMapIndexm_calculator, m_cLogMissingIdx, m_comparator, m_ctx, m_cUnits, m_extractor, m_fForwardIndex, m_fImmutableValues, m_fOrdered, m_fSplitCollection, m_ldtLogMissingIdx, m_mapForward, m_mapInverse, m_setKeyExcluded
- 
Constructor SummaryConstructorsConstructorDescriptionConditionalIndex(Filter filter, ValueExtractor extractor, boolean fOrdered, Comparator comparator, boolean fForwardIndex, BackingMapContext ctx) Construct a ConditionalIndex.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddeleteInternal(Map.Entry entry) Update this index in response to a remove operation on a cache.booleanCompares the specified object with this index for equality.protected booleanevaluateEntry(Map.Entry entry) Evaluate the given entry using this index's filter.Using the index information if possible, get the value associated with the specified key.Get the associated filter.protected Map.EntrygetForwardEntry(Object oKey) Get the forward index entry associated with the specified key.protected voidinsertInternal(Map.Entry entry) Update this index in response to a insert operation on a cache.protected MapInstantiate the forward index.booleanDetermine if indexed information for any entry in the indexed Map has been excluded from this index.protected voidremoveForwardEntry(Object oKey) Remove the forward index entry for the specified key.toString()Returns a string representation of this ConditionalIndex.voidUpdate this index in response to an update operation on a cache.protected voidupdateInternal(Map.Entry entry) Update this index in response to an update operation on a cache.Methods inherited from class com.tangosol.util.SimpleMapIndexaddForwardEntry, addInverseCollectionMapping, addInverseMapping, addInverseMapping, collectRemoved, delete, ensureCollection, extractNewValue, extractOldValue, getCalculator, getComparator, getIndexContents, getUnits, getValueExtractor, hashCode, initialize, insert, instantiateCalculator, instantiateInverseIndex, instantiateSet, isForwardIndexSupported, isKeyExcluded, isOptimizeMV, isOrdered, logMissingIdx, onMappingAdded, onMappingAdded, onMappingRemoved, onMappingRemoved, removeInverseMapping, removeInverseMapping, removeInverseMapping, setOptimizeMV, setUnits, toString, updateExcludedKeys, updateForwardEntryMethods inherited from class com.tangosol.util.Baseazzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
- 
Constructor Details- 
ConditionalIndexpublic ConditionalIndex(Filter filter, ValueExtractor extractor, boolean fOrdered, Comparator comparator, boolean fForwardIndex, BackingMapContext ctx) Construct a ConditionalIndex.- Parameters:
- filter- the filter that is used to evaluate the entries of the resource map that is being indexed
- extractor- the- ValueExtractorthat 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
- comparator- 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
- ctx- the- contextassociated with this index
 
 
- 
- 
Method Details- 
getUsing 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:
- getin interface- MapIndex
- Overrides:
- getin class- SimpleMapIndex
- 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
 
- 
getForwardEntryGet the forward index entry associated with the specified key.- Overrides:
- getForwardEntryin class- SimpleMapIndex
- Parameters:
- oKey- the key
- Returns:
- the entry associated with the given key
 
- 
removeForwardEntryRemove the forward index entry for the specified key.- Overrides:
- removeForwardEntryin class- SimpleMapIndex
- Parameters:
- oKey- the key to remove the forward index entry for
 
- 
instantiateForwardIndexInstantiate 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 SimpleMapIndex.getForwardEntry(Object)method accordingly.- Overrides:
- instantiateForwardIndexin class- SimpleMapIndex
- Returns:
- the forward index
 
- 
isPartialpublic boolean isPartial()Determine if indexed information for any entry in the indexed Map has been excluded from this index. This information is used forIndexAwareFilterimplementations 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:
- isPartialin interface- MapIndex
- Overrides:
- isPartialin class- SimpleMapIndex
- Returns:
- true if any entry of the indexed Map has been excluded from the index, false otherwise
 
- 
getFilterGet the associated filter.- Returns:
- the filter
 
- 
evaluateEntryEvaluate 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:
- entry- the entry to evaluate
- Returns:
- true if the entry passes the filter, false otherwise
 
- 
updateUpdate this index in response to an update operation on a cache.- Specified by:
- updatein interface- MapIndex
- Overrides:
- updatein class- SimpleMapIndex
- Parameters:
- entry- the entry representing the object being updated
 
- 
insertInternalUpdate this index in response to a insert operation on a cache.- Overrides:
- insertInternalin class- SimpleMapIndex
- Parameters:
- entry- the entry representing the object being inserted
 
- 
updateInternalUpdate this index in response to an update operation on a cache.- Overrides:
- updateInternalin class- SimpleMapIndex
- Parameters:
- entry- the entry representing the object being updated
 
- 
deleteInternalUpdate this index in response to a remove operation on a cache.- Overrides:
- deleteInternalin class- SimpleMapIndex
- Parameters:
- entry- the entry representing the object being removed
 
- 
toStringReturns a string representation of this ConditionalIndex. The string representation consists of the SimpleMapIndex representation concatenated by the Filter and the ForwardIndexSupported flag.- Overrides:
- toStringin class- SimpleMapIndex
- Returns:
- a String representation of this ConditionalIndex
 
- 
equalsCompares 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.- Overrides:
- equalsin class- SimpleMapIndex
- Parameters:
- o- object to be compared for equality with this MapIndex
- Returns:
- true if the specified object is equal to this index
 
 
-