Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

# coherence/util/filter/ContainsAnyFilter.hpp

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

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.