coherence/util/filter/AllFilter.hpp

00001 /*
00002 * AllFilter.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_ALL_FILTER_HPP
00017 #define COH_ALL_FILTER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/Map.hpp"
00022 #include "coherence/util/filter/ArrayFilter.hpp"
00023 
00024 COH_OPEN_NAMESPACE3(coherence,util,filter)
00025 
00026 
00027 /**
00028 * Filter which returns the logical "and" of a filter array.
00029 *
00030 * @author djl  2008.03.23
00031 */
00032 class COH_EXPORT AllFilter
00033     : public class_spec<AllFilter,
00034         extends<ArrayFilter> >
00035     {
00036     friend class factory<AllFilter>;
00037 
00038     // ----- constructors ---------------------------------------------------
00039 
00040     protected:
00041         /**
00042         * Default constructor (necessary for the PortableObject interface).
00043         */
00044         AllFilter();
00045 
00046         /**
00047         * Construct an "all" filter. The result is defined as:
00048         *
00049         * afilter[0] &amp;&amp; afilter[1] ... &amp;&amp; afilter[n]
00050         *
00051         * @param vaFilter  an array of filters
00052         */
00053         AllFilter(ObjectArray::View vaFilter);
00054 
00055 
00056     // ----- EntryFilter interface ------------------------------------------
00057 
00058     public:
00059         /**
00060         * {@inheritDoc}
00061         */
00062         virtual bool evaluateEntry(Map::Entry::View vEntry) const;
00063 
00064 
00065     // ----- Filter interface -----------------------------------------------
00066 
00067     public:
00068         /**
00069         * {@inheritDoc}
00070         */
00071         virtual bool evaluate(Object::View v) const;
00072 
00073 
00074     // ----- IndexAwareFilter interface -------------------------------------
00075 
00076     public:
00077         /**
00078         * {@inheritDoc}
00079         */
00080         virtual size32_t calculateEffectiveness(Map::View vMapIndexes,
00081                 Set::View vSetKeys) const;
00082 
00083         /**
00084         * {@inheritDoc}
00085         */
00086         virtual Filter::View applyIndex(Map::View vMapIndexes,
00087                 Set::Handle hSetKeys) const;
00088     };
00089 
00090 COH_CLOSE_NAMESPACE3
00091 
00092 #endif // COH_ALL_FILTER_HPP
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.