1 package org.lcsim.geometry.compact;
2
3 import java.util.HashMap;
4 import java.util.Iterator;
5 import java.util.Map;
6 import org.jdom.Element;
7
8
9
10
11
12 public class LimitSet
13 {
14 private Map<String, Limit> limits = new HashMap<String, Limit>();
15 private String name;
16
17 protected LimitSet(Element node)
18 {
19 name = node.getAttributeValue("name");
20 addLimits(node);
21 }
22
23 public void addLimit(String name, Limit limit)
24 {
25 limits.put(name, limit);
26 }
27
28 private void addLimits(Element node)
29 {
30 for (Iterator i = node.getChildren("limit").iterator(); i.hasNext(); )
31 {
32 Element e = (Element) i.next();
33 Limit l = new Limit(e);
34 addLimit(l.getName(), l);
35 }
36 }
37
38 public Limit getLimit(String name)
39 {
40 return limits.get(name);
41 }
42
43 public Map<String, Limit> getLimits()
44 {
45 return limits;
46 }
47
48 public String getName()
49 {
50 return name;
51 }
52 }