01: /*
02: * Created on Nov 17, 2004
03: */
04: package uk.org.ponder.util;
05:
06: import java.util.Collection;
07: import java.util.Map;
08: import java.util.Set;
09:
10: /**
11: * A Map wrapper that essentially only allows the get operation to proceed.
12: * @author Antranig Basman (antranig@caret.cam.ac.uk)
13: *
14: */
15: public abstract class ObstinateMap implements Map {
16:
17: public int size() {
18: throw new UniversalRuntimeException("Cannot compute size of "
19: + getClass() + " map");
20: }
21:
22: public void clear() {
23: throw new UniversalRuntimeException("Cannot clear "
24: + getClass() + " map");
25: }
26:
27: public boolean isEmpty() {
28: return false;
29: }
30:
31: public boolean containsValue(Object value) {
32: throw new UniversalRuntimeException("Cannot query value in "
33: + getClass() + " map");
34: }
35:
36: public Collection values() {
37: throw new UniversalRuntimeException(
38: "Cannot assemble values in " + getClass() + " map");
39: }
40:
41: public void putAll(Map t) {
42: throw new UniversalRuntimeException("Cannot modify "
43: + getClass() + " map");
44: }
45:
46: public Set entrySet() {
47: throw new UniversalRuntimeException(
48: "Cannot assemble entries in " + getClass() + " map");
49: }
50:
51: public Set keySet() {
52: throw new UniversalRuntimeException("Cannot assemble keys in "
53: + getClass() + " map");
54: }
55:
56: public Object remove(Object key) {
57: throw new UniversalRuntimeException("Cannot modify "
58: + getClass() + " map");
59: }
60:
61: public Object put(Object key, Object value) {
62: throw new UniversalRuntimeException("Cannot modify "
63: + getClass() + " map");
64: }
65:
66: }
|