00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _DECAF_UTIL_MAP_H_ 00019 #define _DECAF_UTIL_MAP_H_ 00020 00021 #include <functional> 00022 #include <vector> 00023 #include <decaf/lang/exceptions/UnsupportedOperationException.h> 00024 #include <decaf/util/NoSuchElementException.h> 00025 #include <decaf/util/concurrent/Synchronizable.h> 00026 #include <decaf/util/Set.h> 00027 #include <decaf/util/Collection.h> 00028 #include <decaf/util/MapEntry.h> 00029 00030 namespace decaf{ 00031 namespace util{ 00032 00087 template <typename K, typename V> 00088 class Map : public concurrent::Synchronizable { 00089 public: 00090 00094 Map() : concurrent::Synchronizable() {} 00095 00096 virtual ~Map() {} 00097 00109 virtual bool equals(const Map& source) const = 0; 00110 00119 virtual void copy(const Map& source) = 0; 00120 00127 virtual void clear() = 0; 00128 00139 virtual bool containsKey(const K& key) const = 0; 00140 00152 virtual bool containsValue(const V& value) const = 0; 00153 00157 virtual bool isEmpty() const = 0; 00158 00162 virtual int size() const = 0; 00163 00176 virtual V& get(const K& key) = 0; 00177 00190 virtual const V& get(const K& key) const = 0; 00191 00210 virtual bool put(const K& key, const V& value) = 0; 00211 00237 virtual bool put(const K& key, const V& value, V& oldValue) = 0; 00238 00252 virtual void putAll(const Map<K, V>& other) = 0; 00253 00267 virtual V remove(const K& key) = 0; 00268 00281 virtual Set< MapEntry<K,V> >& entrySet() = 0; 00282 virtual const Set< MapEntry<K,V> >& entrySet() const = 0; 00283 00295 virtual Set<K>& keySet() = 0; 00296 virtual const Set<K>& keySet() const = 0; 00297 00310 virtual Collection<V>& values() = 0; 00311 virtual const Collection<V>& values() const = 0; 00312 00313 }; 00314 00315 }} 00316 00317 #endif /*_DECAF_UTIL_MAP_H_*/
1.6.1