Class Count<K,V>
- All Implemented Interfaces:
ExternalizableLite, PortableObject, InvocableMap.EntryAggregator<K,V, Integer>, InvocableMap.StreamingAggregator<K, V, Integer, Integer>, Serializable
- Since:
- Coherence 3.1
- Author:
- gg 2005.09.05
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Base
Base.LoggingWriterNested classes/interfaces inherited from interface InvocableMap.StreamingAggregator
InvocableMap.StreamingAggregator.RetractionResult -
Field Summary
Fields inherited from class Base
DEFAULT_LOAD_FACTOR, LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_USFields inherited from interface InvocableMap.StreamingAggregator
ALLOW_INCONSISTENCIES, BY_MEMBER, BY_PARTITION, CONTINUOUS, PARALLEL, PRESENT_ONLY, RETAINS_ENTRIES, SERIAL, STATE_CHECKPOINTABLE -
Constructor Summary
ConstructorsConstructorDescriptionCount()Default constructor (necessary for the ExternalizableLite interface). -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccumulate(InvocableMap.Entry<? extends K, ? extends V> entry) Accumulate one entry into the result.booleanaccumulate(Streamer<? extends InvocableMap.Entry<? extends K, ? extends V>> streamer) Accumulate multiple entries into the result.intA bit mask representing the set of characteristics of this aggregator.booleanMerge another partial result into the result.booleanReturn the final result of the aggregation.Return the partial result of the aggregation.inthashCode()voidRestore the contents of a user type instance by reading its state using the specified PofReader object.voidRestore the contents of this object by loading the object's state from the passed DataInput object.voidrestoreState(Object state) Restore a maintenance-state snapshot into this empty supplied instance.retract(InvocableMap.Entry<? extends K, ? extends V> entry) Retract the contribution of a single entry from the aggregation result.Return a detached, serializer-compatible snapshot of the state required to continue incremental maintenance.supply()Create a new instance of this aggregator.update(InvocableMap.Entry<? extends K, ? extends V> entry) Replace the contribution of an entry that was present before and remains present after a map update.voidwriteExternal(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object.voidwriteExternal(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.Methods inherited from class Base
azzert, 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, waitMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface InvocableMap.StreamingAggregator
aggregate, finalizeResult, getMaintenanceStatus, isAllowInconsistencies, isByMember, isByPartition, isContinuous, isParallel, isPresentOnly, isRetainsEntries, isSerial, isStateCheckpointable
-
Constructor Details
-
Count
public Count()Default constructor (necessary for the ExternalizableLite interface).
-
-
Method Details
-
supply
Description copied from interface:InvocableMap.StreamingAggregatorCreate a new instance of this aggregator. -
accumulate
public boolean accumulate(Streamer<? extends InvocableMap.Entry<? extends K, ? extends V>> streamer) Description copied from interface:InvocableMap.StreamingAggregatorAccumulate multiple entries into the result.Important note: The default implementation of this method provides necessary logic for aggregation short-circuiting and should rarely (if ever) be overridden by the custom aggregator implementation.
- Specified by:
accumulatein interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Parameters:
streamer- aStreamerthat can be used to iterate over entries to add- Returns:
trueto continue the aggregation, andfalseto signal to the caller that the result is ready and the aggregation can be short-circuited
-
accumulate
Description copied from interface:InvocableMap.StreamingAggregatorAccumulate one entry into the result.- Specified by:
accumulatein interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Parameters:
entry- the entry to accumulate into the aggregation result- Returns:
trueto continue the aggregation, andfalseto signal to the caller that the result is ready and the aggregation can be short-circuited
-
retract
public InvocableMap.StreamingAggregator.RetractionResult retract(InvocableMap.Entry<? extends K, ? extends V> entry) Description copied from interface:InvocableMap.StreamingAggregatorRetract the contribution of a single entry from the aggregation result.When the supplied entry is a
MapTrigger.Entry, an implementation should retract the entry's original value. Otherwise, it should retract the value represented by the supplied entry.The default implementation cannot retract an entry and requires the caller to rebuild the aggregation result.
-
update
public InvocableMap.StreamingAggregator.RetractionResult update(InvocableMap.Entry<? extends K, ? extends V> entry) Description copied from interface:InvocableMap.StreamingAggregatorReplace the contribution of an entry that was present before and remains present after a map update.The supplied entry is expected to be a
MapTrigger.Entryexposing both its original and current values. The default implementation retracts the original contribution, accumulates the current contribution, and therefore preserves the semantics of an update for aggregators that do not provide a specialized implementation. -
combine
Description copied from interface:InvocableMap.StreamingAggregatorMerge another partial result into the result. -
getPartialResult
Description copied from interface:InvocableMap.StreamingAggregatorReturn the partial result of the aggregation.- Specified by:
getPartialResultin interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Returns:
- the partial result of the aggregation
-
finalizeResult
Description copied from interface:InvocableMap.StreamingAggregatorReturn the final result of the aggregation.- Specified by:
finalizeResultin interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Returns:
- the final result of the aggregation
-
snapshotState
Description copied from interface:InvocableMap.StreamingAggregatorReturn a detached, serializer-compatible snapshot of the state required to continue incremental maintenance.This method is used only when
InvocableMap.StreamingAggregator.STATE_CHECKPOINTABLEis advertised. The default implementation does not support state checkpointing.- Specified by:
snapshotStatein interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Returns:
- a detached maintenance-state snapshot
-
restoreState
Description copied from interface:InvocableMap.StreamingAggregatorRestore a maintenance-state snapshot into this empty supplied instance.This method is used only when
InvocableMap.StreamingAggregator.STATE_CHECKPOINTABLEis advertised. The default implementation does not support state checkpointing.- Specified by:
restoreStatein interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Parameters:
state- the snapshot returned byInvocableMap.StreamingAggregator.snapshotState()
-
characteristics
public int characteristics()Description copied from interface:InvocableMap.StreamingAggregatorA bit mask representing the set of characteristics of this aggregator.By default, characteristics are a combination of
InvocableMap.StreamingAggregator.PARALLELandInvocableMap.StreamingAggregator.RETAINS_ENTRIES, which is sub-optimal and should be overridden by the aggregator implementation if the aggregator does not need to retain entries (which is often the case).- Specified by:
characteristicsin interfaceInvocableMap.StreamingAggregator<K,V, Integer, Integer> - Returns:
- a bit mask representing the set of characteristics of this aggregator
- See Also:
-
equals
-
hashCode
-
readExternal
Restore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternalin interfaceExternalizableLite- Parameters:
in- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException- if an I/O exception occurs
-
writeExternal
Save the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternalin interfaceExternalizableLite- Parameters:
out- the DataOutput stream to write the state of this object to- Throws:
IOException- if an I/O exception occurs
-
readExternal
Restore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternalin interfacePortableObject- Parameters:
in- the PofReader from which to read the object's state- Throws:
IOException- if an I/O error occurs
-
writeExternal
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternalin interfacePortableObject- Parameters:
out- the PofWriter to which to write the object's state- Throws:
IOException- if an I/O error occurs
-