coherence/util/aggregator/ComparableMin.hpp

00001 /*
00002 * ComparableMin.hpp
00003 *
00004 * Copyright (c) 2000, 2009, 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_MIN_HPP
00017 #define COH_COMPARABLE_MIN_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 minimum 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.09
00034 */
00035 class COH_EXPORT ComparableMin
00036     : public class_spec<ComparableMin,
00037         extends<AbstractComparableAggregator> >
00038     {
00039     friend class factory<ComparableMin>;
00040 
00041     // ----- constructors ---------------------------------------------------
00042 
00043     protected:
00044         /**
00045         * Default constructor (necessary for the PortableObject interface).
00046         */
00047         ComparableMin();
00048 
00049         /**
00050         * Construct a ComparableMin aggregator.
00051         *
00052         * @param vExtractor  the extractor that provides an object to be compared
00053         * @param vComparator the comparator used to compare the extracted
00054         *                    object, if NULL then the extracted object must
00055         *                    implement Comparable
00056         */
00057         ComparableMin(ValueExtractor::View vExtractor,
00058                 Comparator::View vComparator = NULL);
00059 
00060 
00061     // ----- AbstractAggregator Interface  ----------------------------------
00062 
00063     protected:
00064         /**
00065         * {@inheritDoc}
00066         */
00067         virtual void process(Object::View v, bool fFinal);
00068     };
00069 
00070 COH_CLOSE_NAMESPACE3
00071 
00072 #endif // COH_COMPARABLE_MIN_HPP
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.