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

E47891-01

coherence/util/filter/ContainsFilter.hpp

00001 /*
00002 * ContainsFilter.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_CONTAINS_FILTER_HPP
00017 #define COH_CONTAINS_FILTER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/ValueExtractor.hpp"
00022 #include "coherence/util/filter/ComparisonFilter.hpp"
00023 #include "coherence/util/filter/IndexAwareFilter.hpp"
00024 
00025 COH_OPEN_NAMESPACE3(coherence,util,filter)
00026 
00027 
00028 /**
00029 * Filter which tests a Collection or ObjectArray value returned from
00030 * a method invocation for containment of a given value.
00031 *
00032 * More formally, if the specified extractor returns a Collection,
00033 * evaluate(o)is functionally equivalent to the following code:
00034 * <pre>
00035 * return ((Collection) extract(o))->contains(getValue());
00036 * </pre>
00037 * If the specified method returns an ObjectArray, evaluate(o) is functionally
00038 * equivalent to the following code:
00039 * <pre>
00040 * return Collections->asList((ObjectArray::View) extract(o))->contains(
00041 *           getValue());
00042 * </pre>
00043 *
00044 * @author djl  2008.04.07
00045 */
00046 class COH_EXPORT ContainsFilter
00047     : public class_spec<ContainsFilter,
00048         extends<ComparisonFilter>,
00049         implements<IndexAwareFilter> >
00050     {
00051     friend class factory<ContainsFilter>;
00052 
00053     // ----- constructors ---------------------------------------------------
00054 
00055     protected:
00056         /**
00057         * Default constructor (necessary for the PortableObject interface).
00058         */
00059         ContainsFilter();
00060 
00061         /**
00062         * Construct an ContainsFilter for testing containment of the given
00063         * object.
00064         *
00065         * @param vExtractor  the ValueExtractor used by this filter
00066         * @param vValue      the object that a Collection or ObjectArray is
00067         *                    tested to contain
00068         */
00069         ContainsFilter(ValueExtractor::View vExtractor, Object::View vValue);
00070 
00071     private:
00072         /**
00073         * Blocked copy constructor.
00074         */
00075         ContainsFilter(const ContainsFilter&);
00076 
00077 
00078     // ----- ExtractorFilter interface --------------------------------------
00079 
00080     protected:
00081         /**
00082         * Evaluate the specified extracted value.
00083         *
00084         * @param vExtracted an extracted value to evaluate
00085         */
00086         virtual bool evaluateExtracted(Object::View vExtracted) const;
00087 
00088 
00089     // ----- IndexAwareFilter interface -------------------------------------
00090 
00091     public:
00092         /**
00093         * {@inheritDoc}
00094         */
00095         virtual size32_t calculateEffectiveness(Map::View vMapIndexes,
00096                 Set::View vSetKeys) const;
00097 
00098         /**
00099         * {@inheritDoc}
00100         */
00101         virtual Filter::View applyIndex(Map::View vMapIndexes,
00102                 Set::Handle hSetKeys) const;
00103    };
00104 
00105 COH_CLOSE_NAMESPACE3
00106 
00107 #endif // COH_CONTAINS_FILTER_HPP
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.