00001 /* 00002 * ComparableMin.hpp 00003 * 00004 * Copyright (c) 2000, 2014, 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 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 ComparableMin(ValueExtractor::View vExtractor, 00059 Comparator::View vComparator = NULL); 00060 00061 /** 00062 * Construct a ComparableMin 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 on the ChainedExtractor 00070 * that is based on an array of corresponding 00071 * ReflectionExtractor objects 00072 * @param vComparator the comparator used to compare the extracted 00073 * object, if NULL then the extracted object must 00074 * implement Comparable 00075 * 00076 * @since Coherence 12.1.2 00077 */ 00078 ComparableMin(String::View vsMethod, 00079 Comparator::View vComparator = NULL); 00080 00081 private: 00082 /** 00083 * Blocked copy constructor. 00084 */ 00085 ComparableMin(const ComparableMin&); 00086 00087 00088 // ----- AbstractAggregator Interface ---------------------------------- 00089 00090 protected: 00091 /** 00092 * {@inheritDoc} 00093 */ 00094 virtual void process(Object::View v, bool fFinal); 00095 }; 00096 00097 COH_CLOSE_NAMESPACE3 00098 00099 #endif // COH_COMPARABLE_MIN_HPP