Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.util.aggregator
Class AbstractComparableAggregator

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.util.BitHelper
              com.tangosol.util.ExternalizableHelper
                  com.tangosol.util.aggregator.AbstractAggregator
                      com.tangosol.util.aggregator.AbstractComparableAggregator

All Implemented Interfaces:
  ExternalizableLite, PortableObject, InvocableMap.EntryAggregator, InvocableMap.ParallelAwareAggregator, java.io.Serializable

Direct Known Subclasses:
  ComparableMax, ComparableMin

    public abstract class AbstractComparableAggregator

extends AbstractAggregator

Abstract aggregator that processes values extracted from a set of entries in a Map, with knowledge of how to compare those values. There are two way to use the AbstractComparableAggregator:

- All the extracted objects must implement `Comparable`, or
- The AbstractComparableAggregator has to be provided with a `Comparator` object.

If the set of entries passed to `AbstractAggregator.aggregate(java.util.Set)` is empty, a `null` result is returned.

Since:
  Coherence 3.2
Author:
  gg 2006.02.13

Field Summary
`protected java.util.Comparator` | `m_comparator` The comparator to use for comparing extracted values.
`protected int` | `m_count` The count of processed entries.
`protected java.lang.Object` | `m_oResult` The running result value.

Fields inherited from class com.tangosol.util.aggregator.AbstractAggregator
`m_fParallel`

Constructor Summary
`AbstractComparableAggregator()` Default constructor (necessary for the ExternalizableLite interface).
`AbstractComparableAggregator(java.lang.String sMethod)` Construct an AbstractComparableAggregator object.
`AbstractComparableAggregator(ValueExtractor extractor)` Construct an AbstractComparableAggregator object.
`AbstractComparableAggregator(ValueExtractor extractor, java.util.Comparator comparator)` Construct an AbstractComparableAggregator object.

Method Summary
`protected java.lang.Object` | `finalizeResult(boolean fFinal)` Obtain the result of the aggregation.
`protected void` | `init(boolean fFinal)` Initialize the aggregation result.
`void` | `readExternal(java.io.DataInput in)` Restore the contents of this object by loading the object's state from the passed DataInput object.
`void` | `readExternal(PofReader in)` Restore the contents of a user type instance by reading its state using the specified PofReader object.
`void` | `writeExternal(java.io.DataOutput out)` Save the contents of this object by storing the object's state into the passed DataOutput object.
`void` | `writeExternal(PofWriter out)` Save the contents of a POF user type instance by writing its state using the specified PofWriter object.

Methods inherited from class com.tangosol.util.aggregator.AbstractAggregator
`aggregate, aggregateResults, equals, getParallelAggregator, getValueExtractor, hashCode, process, toString`

Methods inherited from class com.tangosol.util.BitHelper
`countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString`

Field Detail

### m_count

    protected transient int m_count

  The count of processed entries.

### m_oResult

    protected transient java.lang.Object m_oResult

  The running result value.

### m_comparator

    protected java.util.Comparator m_comparator

  The comparator to use for comparing extracted values.

Constructor Detail

### AbstractComparableAggregator

    public AbstractComparableAggregator()

  Default constructor (necessary for the ExternalizableLite interface).

### AbstractComparableAggregator

    public AbstractComparableAggregator(ValueExtractor extractor)

  Construct an AbstractComparableAggregator object.

  Parameters:
    `extractor` - the extractor that provides a value in the form of any object that implements the `Comparable` interface

### AbstractComparableAggregator

    public AbstractComparableAggregator(ValueExtractor extractor,
                                        java.util.Comparator comparator)

  Construct an AbstractComparableAggregator object.

  Parameters:
    `extractor` - the extractor that provides an object to be compared
    `comparator` - the comparator used to compare the extracted object

### AbstractComparableAggregator

    public AbstractComparableAggregator(java.lang.String sMethod)

  Construct an AbstractComparableAggregator object.

  Parameters:
    `sMethod` - the name of the method that returns a value in the form of any object that implements the `Comparable` interface

Method Detail

### init

    protected void init(boolean fFinal)

  Initialize the aggregation result.

  Specified by:
    `init` in class `AbstractAggregator`
  Parameters:
    `fFinal` - true is passed if the aggregation process that is being initialized must produce a final aggregation result; this will only be false if a parallel approach is being used and the initial (partial) aggregation process is being initialized

### finalizeResult

    protected java.lang.Object finalizeResult(boolean fFinal)

  Obtain the result of the aggregation.

  If the `fFinal` parameter is true, the returned object must be the final result of the aggregation; otherwise, the returned object will be treated as a partial result that should be incorporated into the final result.

  Specified by:
    `finalizeResult` in class `AbstractAggregator`
  Parameters:
    `fFinal` - true to indicate that the final result of the aggregation process should be returned; this will only be false if a parallel approach is being used
  Returns:
    the result of the aggregation process

### readExternal

    public void readExternal(java.io.DataInput in)
                      throws java.io.IOException

  Restore the contents of this object by loading the object's state from the passed DataInput object.

  Specified by:
    `readExternal` in interface `ExternalizableLite`
  Overrides:
    `readExternal` in class `AbstractAggregator`
  Parameters:
    `in` - the DataInput stream to read data from in order to restore the state of this object
  Throws:
    `java.io.IOException` - if an I/O exception occurs
    `java.io.NotActiveException` - if the object is not in its initial state, and therefore cannot be deserialized into

### writeExternal

    public void writeExternal(java.io.DataOutput out)
                       throws java.io.IOException

  Save the contents of this object by storing the object's state into the passed DataOutput object.

  Specified by:
    `writeExternal` in interface `ExternalizableLite`
  Overrides:
    `writeExternal` in class `AbstractAggregator`
  Parameters:
    `out` - the DataOutput stream to write the state of this object to
  Throws:
    `java.io.IOException` - if an I/O exception occurs

### readExternal

    public void readExternal(PofReader in)
                      throws java.io.IOException

  Restore the contents of a user type instance by reading its state using the specified PofReader object.

  Specified by:
    `readExternal` in interface `PortableObject`
  Overrides:
    `readExternal` in class `AbstractAggregator`
  Parameters:
    `in` - the PofReader from which to read the object's state
  Throws:
    `java.io.IOException` - if an I/O error occurs

### writeExternal

    public void writeExternal(PofWriter out)
                       throws java.io.IOException

  Save the contents of a POF user type instance by writing its state using the specified PofWriter object.

  Specified by:
    `writeExternal` in interface `PortableObject`
  Overrides:
    `writeExternal` in class `AbstractAggregator`
  Parameters:
    `out` - the PofWriter to which to write the object's state
  Throws:
    `java.io.IOException` - if an I/O error occurs

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.