Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

coherence/util/aggregator/ComparableMax.hpp

00001 /*
00002 * ComparableMax.hpp
00003 *
00004 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_COMPARABLE_MAX_HPP
00017 #define COH_COMPARABLE_MAX_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/aggregator/AbstractComparableAggregator.hpp"
00022 #include "coherence/util/ValueExtractor.hpp"
00023 
00024 COH_OPEN_NAMESPACE3(coherence,util,aggregator)
00025 
00026 
00027 /**
00028 * Calculates a maximum among values extracted from a set of entries in a Map.
00029 * This aggregator is most commonly used with objects that implement
00030 * <tt>Comparable</tt> such as <tt>String<tt/>; a <tt>Comparator</tt> can also
00031 * be supplied to perform the comparisons.
00032 *
00033 * @author djl/pp  2008.05.12
00034 */
00035 class COH_EXPORT ComparableMax
00036     : public class_spec<ComparableMax,
00037         extends<AbstractComparableAggregator> >
00038     {
00039     friend class factory<ComparableMax>;
00040 
00041     // ----- constructors ---------------------------------------------------
00042 
00043     protected:
00044         /**
00045         * Default constructor (necessary for the PortableObject interface).
00046         */
00047         ComparableMax();
00048 
00049         /**
00050         * Construct a ComparableMax aggregator.
00051         *
00052         * @param vExtractor   the extractor that provides an object to be 
00053         *                     compared
00054         * @param vComparator  the comparator used to compare the extracted
00055         *                     object, if NULL then the extracted object must
00056         *                     implement Comparable
00057         */
00058         ComparableMax(ValueExtractor::View vExtractor,
00059                 Comparator::View vComparator = NULL);
00060 
00061         /**
00062         * Construct a ComparableMax that will aggregate values extracted
00063         * from a set of InvocableMap::Entry objects.
00064         *
00065         * @param vsMethod     the name of the method that could be invoked via
00066         *                     reflection and that returns values to aggregate;
00067         *                     this parameter can also be a dot-delimited 
00068         *                     sequence of method names which would result in
00069         *                     an aggregator based
00070         *                     on the ChainedExtractor that is based on an
00071         *                     array of corresponding ReflectionExtractor
00072         *                     objects
00073         * @param vComparator  the comparator used to compare the extracted
00074         *                     object, if NULL then the extracted object must
00075         *                     implement Comparable
00076         *
00077         * @since Coherence 12.1.2
00078         */
00079         ComparableMax(String::View vsMethod, 
00080             Comparator::View vComparator = NULL);
00081 
00082     private:
00083         /**
00084         * Blocked copy constructor.
00085         */
00086         ComparableMax(const ComparableMax&);
00087 
00088 
00089     // ----- AbstractAggregator Interface  ----------------------------------
00090 
00091     protected:
00092         /**
00093         * {@inheritDoc}
00094         */
00095         virtual void process(Object::View v, bool fFinal);
00096     };
00097 
00098 COH_CLOSE_NAMESPACE3
00099 
00100 #endif // COH_COMPARABLE_MAX_HPP
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.