00001 /* 00002 * Float64Average.hpp 00003 * 00004 * Copyright (c) 2000, 2019, 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_FLOAT64_AVERAGE_HPP 00017 #define COH_FLOAT64_AVERAGE_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/util/aggregator/AbstractFloat64Aggregator.hpp" 00022 #include "coherence/util/ValueExtractor.hpp" 00023 00024 COH_OPEN_NAMESPACE3(coherence,util,aggregator) 00025 00026 00027 /** 00028 * Calculates an average for values of any numberic type extracted from a set 00029 * of entries in a Map. All the extracted Number objects will be treated as 00030 * <tt>float64_t</tt> values. If the set of entries is empty, a 00031 * <tt>NULL</tt> result is returned. 00032 * 00033 * @author djl 2008.05.09 00034 */ 00035 class COH_EXPORT Float64Average 00036 : public class_spec<Float64Average, 00037 extends<AbstractFloat64Aggregator> > 00038 { 00039 friend class factory<Float64Average>; 00040 00041 // ----- constructors --------------------------------------------------- 00042 00043 protected: 00044 /** 00045 * Default constructor (necessary for the PortableObject interface). 00046 */ 00047 Float64Average(); 00048 00049 /** 00050 * Construct a Float64Average aggregator. 00051 * 00052 * @param vExtractor the extractor that provides a value in the form 00053 * of any object that is a Number 00054 */ 00055 Float64Average(ValueExtractor::View vExtractor); 00056 00057 /** 00058 * Construct an Float64Average that will aggregate values extracted 00059 * from a set of InvocableMap::Entry objects. 00060 * 00061 * @param vsMethod the name of the method that could be invoked via 00062 * reflection and that returns values to aggregate; 00063 * this parameter can also be a dot-delimited 00064 * sequence of method names which would result in 00065 * an aggregator based on the ChainedExtractor that 00066 * is based on an array of corresponding 00067 * ReflectionExtractor objects 00068 * 00069 * @since Coherence 12.1.2 00070 */ 00071 Float64Average(String::View vsMethod); 00072 00073 private: 00074 /** 00075 * Blocked copy constructor. 00076 */ 00077 Float64Average(const Float64Average&); 00078 00079 00080 // ----- AbstractAggregator Interface ---------------------------------- 00081 00082 protected: 00083 /** 00084 * {@inheritDoc} 00085 */ 00086 virtual void init(bool fFinal); 00087 00088 /** 00089 * {@inheritDoc} 00090 */ 00091 virtual void process(Object::View v, bool fFinal); 00092 00093 /** 00094 * {@inheritDoc} 00095 */ 00096 virtual Object::Holder finalizeResult(bool fFinal); 00097 }; 00098 00099 COH_CLOSE_NAMESPACE3 00100 00101 #endif // COH_FLOAT64_AVERAGE_HPP