diff options
author | paltherr <paltherr@epfl.ch> | 2003-07-26 10:30:03 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-07-26 10:30:03 +0000 |
commit | d73289451bd3e7a357f1147f69c49fc2644c376e (patch) | |
tree | 45e6fbb91c6bad97bdd8737f13087c033d6109a1 | |
parent | 69d94c439ca228d7bf51edad2440f84fc5f14483 (diff) | |
download | scala-d73289451bd3e7a357f1147f69c49fc2644c376e.tar.gz scala-d73289451bd3e7a357f1147f69c49fc2644c376e.tar.bz2 scala-d73289451bd3e7a357f1147f69c49fc2644c376e.zip |
- Added ForwardingMap.java
-rw-r--r-- | config/list/lamplib.lst | 1 | ||||
-rw-r--r-- | sources/ch/epfl/lamp/util/ForwardingMap.java | 97 |
2 files changed, 98 insertions, 0 deletions
diff --git a/config/list/lamplib.lst b/config/list/lamplib.lst index e5297a2616..dc50fe5849 100644 --- a/config/list/lamplib.lst +++ b/config/list/lamplib.lst @@ -4,6 +4,7 @@ # $Id$ util/CodePrinter.java +util/ForwardingMap.java util/Pair.java util/Position.java util/SourceFile.java diff --git a/sources/ch/epfl/lamp/util/ForwardingMap.java b/sources/ch/epfl/lamp/util/ForwardingMap.java new file mode 100644 index 0000000000..7efc3627b0 --- /dev/null +++ b/sources/ch/epfl/lamp/util/ForwardingMap.java @@ -0,0 +1,97 @@ +package ch.epfl.lamp.util; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +/** + * This class implements the interface Map by forwarding all its + * operations to an underlying instance of Map. + */ +public class ForwardingMap implements Map { + + //######################################################################## + // Protected Fields + + protected final Map delegate; + + //######################################################################## + // Public Constructors + + public ForwardingMap(Map delegate) { + this.delegate = delegate; + } + + //######################################################################## + // Public Methods - Query operations + + public int size() { + return delegate.size(); + } + + public boolean isEmpty() { + return delegate.isEmpty(); + } + + public boolean containsKey(Object key) { + return delegate.containsKey(key); + } + + public boolean containsValue(Object value) { + return delegate.containsValue(value); + } + + public Object get(Object key) { + return delegate.get(key); + } + + //######################################################################## + // Public Methods - Modification operations + + public Object put(Object key, Object value) { + return delegate.put(key, value); + } + + public Object remove(Object key) { + return delegate.remove(key); + } + + //######################################################################## + // Public Methods - Bulk operations + + public void putAll(Map map) { + delegate.putAll(map); + } + + public void clear() { + delegate.clear(); + } + + //######################################################################## + // Public Methods - Views + + public Set keySet() { + return delegate.keySet(); + } + + public Collection values() { + return delegate.values(); + } + + public Set entrySet() { + return delegate.entrySet(); + } + + //######################################################################## + // Public Methods - Comparison and hashing + + public boolean equals(Object that) { + return delegate.equals(that); + } + + public int hashCode() { + return delegate.hashCode(); + } + + //######################################################################## +} |