1 package net.sf.openrocket.preset;
3 import java.util.Collection;
4 import java.util.LinkedHashMap;
6 import java.util.Map.Entry;
9 public class TypedPropertyMap implements Cloneable {
11 private final Map<TypedKey<?>, Object> delegate;
13 public TypedPropertyMap() {
14 delegate = new LinkedHashMap<TypedKey<?>, Object>();
18 return delegate.size();
21 public boolean isEmpty() {
22 return delegate.isEmpty();
25 public boolean containsKey(Object key) {
26 return delegate.containsKey(key);
29 public boolean containsValue(Object value) {
30 return delegate.containsValue(value);
33 @SuppressWarnings("unchecked")
34 public <T> T get(TypedKey<T> key) {
35 return (T) delegate.get(key);
38 @SuppressWarnings("unchecked")
39 public <T> T put(TypedKey<T> key, T value) {
40 return (T) delegate.put(key, value);
43 public Object remove(Object key) {
44 return delegate.remove(key);
47 public void putAll(TypedPropertyMap other) {
51 delegate.putAll(other.delegate);
58 public Set<TypedKey<?>> keySet() {
59 return delegate.keySet();
62 public Collection<Object> values() {
63 return delegate.values();
66 public Set<Entry<TypedKey<?>, Object>> entrySet() {
67 return delegate.entrySet();
70 public String toString() {
71 StringBuilder sb = new StringBuilder("TypedPropertyMap: { ");
72 for( Map.Entry<TypedKey<?>, Object> e : delegate.entrySet() ) {
73 sb.append(e.getKey()).append(" => ").append(String.valueOf(e.getValue()));
80 protected TypedPropertyMap clone() throws CloneNotSupportedException {
81 TypedPropertyMap clone = new TypedPropertyMap();