1 package org.lcsim.recon.tracking.trfbase;
2
3 import java.util.List;
4 import java.util.ArrayList;
5 import java.util.Iterator;
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public abstract class McCluster extends Cluster
20 {
21
22
23
24
25 private int[] _mcids;
26
27
28
29
30
31
32
33
34
35 public McCluster()
36 {
37 _mcids = new int[0];
38 }
39
40
41
42
43
44
45
46
47 public McCluster( int mcid )
48 {
49 _mcids = new int[1];
50 _mcids[0] = mcid;
51 }
52
53
54
55
56
57
58
59
60 public McCluster( int[] mcids)
61 {
62 _mcids = new int[mcids.length];
63 System.arraycopy(mcids,0, _mcids, 0, mcids.length);
64 }
65
66
67
68
69
70
71
72
73 public McCluster( List mcids)
74 {
75 _mcids = new int[mcids.size()];
76 int i = 0;
77 for(Iterator it = mcids.iterator(); it.hasNext(); )
78 {
79 _mcids[i++] = ((Integer) it.next()).intValue();
80 }
81 }
82
83
84
85
86
87
88
89
90 public McCluster( McCluster mcclus)
91 {
92 _mcids = mcclus._mcids;
93 }
94
95
96
97
98
99
100
101
102 public List mcIds()
103 {
104 List list = new ArrayList();
105 for(int i = 0; i<_mcids.length; ++i)
106 {
107 list.add(new Integer(_mcids[i]));
108 }
109 return list;
110 }
111
112
113
114
115
116
117
118 public int[] mcIdArray()
119 {
120 int[] tmp = new int[_mcids.length];
121 System.arraycopy(_mcids, 0, tmp, 0, _mcids.length);
122 return tmp;
123
124 }
125
126 }
127