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

E26041-01

coherence/util/comparator/QueryMapComparator.hpp

00001 /*
00002 * QueryMapComparator.hpp
00003 *
00004 * Copyright (c) 2000, 2013, 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_QUERY_MAP_COMPARATOR_HPP
00017 #define COH_QUERY_MAP_COMPARATOR_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/Comparator.hpp"
00022 #include "coherence/util/QueryMap.hpp"
00023 
00024 COH_OPEN_NAMESPACE3(coherence,util,comparator)
00025 
00026 
00027 /**
00028 * This interface is used by Comparator implementations that can use value
00029 * extraction optimization exposed by the
00030 * QueryMap::Entry interface.
00031 *
00032 * @author djl  2008.03.03
00033 */
00034 class COH_EXPORT QueryMapComparator
00035     : public interface_spec<QueryMapComparator,
00036         implements<Comparator> >
00037     {
00038     // ----- QueryMap interface ---------------------------------------------
00039 
00040     public:
00041         /**
00042         * Compare two entries based on the rules specified by Comparator.
00043         *
00044         * If possible, use the coherence::util::QueryMap.Entry::extract()
00045         * method to optimize the value extraction process.
00046         *
00047         * This method is expected to be implemented by Comparator wrappers,
00048         * such as ChainedComparator and InverseComparator, which simply pass
00049         * on this invocation to the wrapped Comparator objects if they too
00050         * implement this interface, or to invoke their default compare method
00051         * passing the actual objects (not the extracted values) obtained from
00052         * the extractor using the passed entries.
00053         *
00054         * This interface is also expected to be implemented by ValueExtractor
00055         * implementations that implement the Comparator interface. It is expected
00056         * that in most cases, the Comparator wrappers will eventually terminate
00057         * at (i.e. delegate to) ValueExtractors that also implement this
00058         * interface.
00059         *
00060         * @param vEntry1  the first entry to compare values from; read-only
00061         * @param vEntry2  the second entry to compare values from; read-only
00062         *
00063         * @return a negative integer, zero, or a positive integer as the first
00064         *         entry denotes a value that is is less than, equal to, or
00065         *         greater than the value denoted by the second entry
00066         *
00067         * @throws ClassCastException if the arguments' types prevent them from
00068         *            being compared by this Comparator.
00069         * @throws IllegalArgumentException if the extractor cannot handle
00070         *         the passed objects for any other reason; an implementor should
00071         *         include a descriptive message
00072         */
00073         virtual int32_t compareEntries(QueryMap::Entry::View vEntry1,
00074                 QueryMap::Entry::View vEntry2) const = 0;
00075     };
00076 
00077 COH_CLOSE_NAMESPACE3
00078 
00079 #endif // COH_QUERY_MAP_COMPARATOR_HPP
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.