1 package org.lcsim.geometry.compact;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6
7
8
9
10
11
12 class SystemIDMap
13 {
14 private Map<Integer, Subdetector> _subdetectors = new HashMap<Integer, Subdetector>();
15
16
17
18
19
20
21
22
23
24 protected void add(int sysid, Subdetector subdetector)
25 {
26 if (sysid > 0)
27 {
28 if (_subdetectors.containsKey(sysid))
29 {
30 throw new RuntimeException("The System ID " + sysid + " of " + subdetector.getName()
31 + " is already used by " + _subdetectors.get(sysid).getName());
32 }
33 else
34 {
35 _subdetectors.put(sysid, subdetector);
36 }
37 }
38
39
40
41
42
43 }
44
45
46 protected Subdetector get(int sysid)
47 {
48 return _subdetectors.get(sysid);
49 }
50 }