comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/StackFrames.java @ 415:7c018f466d6d

Datacage: Added river parameter to meta data services. flys-artifacts/trunk@1879 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 10 May 2011 12:43:12 +0000
parents fc3cf0ef777e
children e91996b46e3c
comparison
equal deleted inserted replaced
414:0385bcc4229a 415:7c018f466d6d
11 11
12 public StackFrames() { 12 public StackFrames() {
13 frames = new ArrayList<Map<String, Object>>(); 13 frames = new ArrayList<Map<String, Object>>();
14 } 14 }
15 15
16 public StackFrames(Map<String, Object> initialFrame) {
17 this();
18 if (initialFrame != null) {
19 frames.add(new HashMap<String, Object>(initialFrame));
20 }
21 }
22
16 public void enter() { 23 public void enter() {
17 frames.add(new HashMap<String, Object>()); 24 frames.add(new HashMap<String, Object>());
18 } 25 }
19 26
20 public void leave() { 27 public void leave() {
21 frames.remove(frames.size()-1); 28 frames.remove(frames.size()-1);
22 } 29 }
23 30
31 public void put(String key, Object value) {
32 int N = frames.size();
33 if (N > 0) {
34 frames.get(N-1).put(key, value);
35 }
36 }
37
24 public void put(String [] keys, Object [] values) { 38 public void put(String [] keys, Object [] values) {
25 Map<String, Object> top = frames.get(frames.size()-1); 39 Map<String, Object> top = frames.get(frames.size()-1);
26 for (int i = 0; i < keys.length; ++i) { 40 for (int i = 0; i < keys.length; ++i) {
27 top.put(keys[i], values[i]); 41 top.put(keys[i], values[i]);
28 } 42 }
43 }
44
45 public boolean containsKey(String key) {
46 for (int i = frames.size()-1; i >= 0; --i) {
47 if (frames.get(i).containsKey(key)) {
48 return true;
49 }
50 }
51 return false;
29 } 52 }
30 53
31 public Object get(String key) { 54 public Object get(String key) {
32 return get(key, null); 55 return get(key, null);
33 } 56 }

http://dive4elements.wald.intevation.org