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

E47891-01

coherence/util/AbstractMap.hpp

00001 /*
00002 * AbstractMap.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_ABSTRACT_MAP_HPP
00017 #define COH_ABSTRACT_MAP_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/Collection.hpp"
00022 #include "coherence/util/Describable.hpp"
00023 #include "coherence/util/Iterator.hpp"
00024 #include "coherence/util/Map.hpp"
00025 #include "coherence/util/Set.hpp"
00026 
00027 #include <ostream>
00028 
00029 COH_OPEN_NAMESPACE2(coherence,util)
00030 
00031 
00032 /**
00033 * This class provides a skeletal implementation of the <tt>Map</tt>
00034 * interface, to minimize the effort required to implement this interface.
00035 *
00036 * To implement an unmodifiable map, the programmer needs only to extend this
00037 * class and provide implementations for the entrySet() and
00038 * iterator() methods.  Method <tt>entrySet</tt> returns a set-view of
00039 * the map's mappings. Typically, the returned set will, in turn, be
00040 * implemented atop <tt>AbstractDeepSet</tt>. Method <tt>iterator</tt> returns
00041 * an entry set iterator that points to the mapping for specified key.
00042 *
00043 * To implement a modifiable map, the programmer must additionally override
00044 * this class's <tt>put</tt>, <tt>remove</tt> and <tt>clear</tt> methods
00045 * (which otherwise throw an
00046 * {@link coherence::lang::UnsupportedOperationException
00047 * UnsupportedOperationException}.
00048 *
00049 * The programmer should generally provide a void (no argument) and map
00050 * constructor, as per the recommendation in the <tt>Map</tt> interface
00051 * specification.
00052 *
00053 * @see Map
00054 *
00055 * @author nsa,mf 2008.01.30
00056 */
00057 class COH_EXPORT AbstractMap
00058     : public abstract_spec<AbstractMap,
00059         extends<Describable>,
00060         implements<Map> >
00061     {
00062     // ----- Map interface --------------------------------------------------
00063 
00064     public:
00065         /**
00066         * {@inheritDoc}
00067         */
00068         virtual size32_t size() const;
00069 
00070         /**
00071         * {@inheritDoc}
00072         */
00073         virtual bool isEmpty() const;
00074 
00075         /**
00076         * {@inheritDoc}
00077         */
00078         virtual bool containsKey(Object::View vKey) const;
00079 
00080         /**
00081         * {@inheritDoc}
00082         */
00083         virtual bool containsValue(Object::View vValue) const;
00084 
00085         /**
00086         * {@inheritDoc}
00087         */
00088         virtual Object::Holder get(Object::View vKey) const;
00089 
00090         /**
00091         * {@inheritDoc}
00092         */
00093         virtual Object::Holder get(Object::View vKey);
00094 
00095         /**
00096         * {@inheritDoc}
00097         */
00098         virtual void putAll(Map::View vMap);
00099 
00100         /**
00101         * {@inheritDoc}
00102         */
00103         virtual Set::View keySet() const;
00104 
00105         /**
00106         * {@inheritDoc}
00107         */
00108         virtual Set::Handle keySet();
00109 
00110         /**
00111         * {@inheritDoc}
00112         */
00113         virtual Collection::View values() const;
00114 
00115         /**
00116         * {@inheritDoc}
00117         */
00118         virtual Collection::Handle values();
00119 
00120 
00121     // ----- Object interface -----------------------------------------------
00122 
00123     public:
00124         /**
00125         * {@inheritDoc}
00126         */
00127         virtual bool equals(Object::View v) const;
00128 
00129         /**
00130         * {@inheritDoc}
00131         */
00132         virtual size32_t hashCode() const;
00133 
00134         /**
00135         * {@inheritDoc}
00136         */
00137         virtual void toStream(std::ostream &out) const;
00138     };
00139 
00140 COH_CLOSE_NAMESPACE2
00141 
00142 #endif // COH_ABSTRACT_MAP_HPP
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.