11 |
13 Sep 07 |
nicklas |
1 |
///////////////////////////////////////////////////////////////// |
11 |
13 Sep 07 |
nicklas |
2 |
// |
11 |
13 Sep 07 |
nicklas |
// Copyright (C) 2005 Affymetrix, Inc. |
11 |
13 Sep 07 |
nicklas |
4 |
// |
11 |
13 Sep 07 |
nicklas |
// This library is free software; you can redistribute it and/or modify |
11 |
13 Sep 07 |
nicklas |
// it under the terms of the GNU Lesser General Public License as published |
11 |
13 Sep 07 |
nicklas |
// by the Free Software Foundation; either version 2.1 of the License, |
11 |
13 Sep 07 |
nicklas |
// or (at your option) any later version. |
11 |
13 Sep 07 |
nicklas |
9 |
// |
11 |
13 Sep 07 |
nicklas |
// This library is distributed in the hope that it will be useful, but |
11 |
13 Sep 07 |
nicklas |
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
11 |
13 Sep 07 |
nicklas |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
11 |
13 Sep 07 |
nicklas |
// for more details. |
11 |
13 Sep 07 |
nicklas |
14 |
// |
11 |
13 Sep 07 |
nicklas |
// You should have received a copy of the GNU Lesser General Public License |
11 |
13 Sep 07 |
nicklas |
// along with this library; if not, write to the Free Software Foundation, Inc., |
11 |
13 Sep 07 |
nicklas |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
11 |
13 Sep 07 |
nicklas |
18 |
// |
11 |
13 Sep 07 |
nicklas |
19 |
///////////////////////////////////////////////////////////////// |
11 |
13 Sep 07 |
nicklas |
20 |
|
11 |
13 Sep 07 |
nicklas |
21 |
package affymetrix.fusion.chp; |
11 |
13 Sep 07 |
nicklas |
22 |
|
11 |
13 Sep 07 |
nicklas |
23 |
import affymetrix.fusion.*; |
11 |
13 Sep 07 |
nicklas |
24 |
import affymetrix.gcos.*; |
11 |
13 Sep 07 |
nicklas |
25 |
import affymetrix.gcos.chp.*; |
11 |
13 Sep 07 |
nicklas |
26 |
import affymetrix.calvin.data.*; |
11 |
13 Sep 07 |
nicklas |
27 |
import affymetrix.calvin.parameter.*; |
11 |
13 Sep 07 |
nicklas |
28 |
import java.util.*; |
11 |
13 Sep 07 |
nicklas |
29 |
|
11 |
13 Sep 07 |
nicklas |
/** Stores the contents of the header of a CHP file. */ |
11 |
13 Sep 07 |
nicklas |
31 |
public class FusionCHPHeader { |
11 |
13 Sep 07 |
nicklas |
32 |
|
11 |
13 Sep 07 |
nicklas |
/** Expression assay type. */ |
11 |
13 Sep 07 |
nicklas |
34 |
public static final int EXPRESSION_ASSAY = 0; |
11 |
13 Sep 07 |
nicklas |
35 |
|
11 |
13 Sep 07 |
nicklas |
/** Genotyping assay type. */ |
11 |
13 Sep 07 |
nicklas |
37 |
public static final int GENOTYPING_ASSAY = 1; |
11 |
13 Sep 07 |
nicklas |
38 |
|
11 |
13 Sep 07 |
nicklas |
/** Resequencing assay type. */ |
11 |
13 Sep 07 |
nicklas |
40 |
public static final int RESEQUENCING_ASSAY = 2; |
11 |
13 Sep 07 |
nicklas |
41 |
|
11 |
13 Sep 07 |
nicklas |
/** Universal assay type. */ |
11 |
13 Sep 07 |
nicklas |
43 |
public static final int UNIVERSAL_ASSAY = 3; |
11 |
13 Sep 07 |
nicklas |
44 |
|
11 |
13 Sep 07 |
nicklas |
/** Unknown assay type. */ |
11 |
13 Sep 07 |
nicklas |
46 |
public static final int UNKNOWN_ASSAY = 4; |
11 |
13 Sep 07 |
nicklas |
47 |
|
11 |
13 Sep 07 |
nicklas |
/** The GCOS header object. */ |
11 |
13 Sep 07 |
nicklas |
49 |
private CHPFileHeader gcosHeader; |
11 |
13 Sep 07 |
nicklas |
50 |
|
11 |
13 Sep 07 |
nicklas |
/** Set the gcos header object. |
11 |
13 Sep 07 |
nicklas |
* @param header The GCOS header object. |
11 |
13 Sep 07 |
nicklas |
53 |
*/ |
11 |
13 Sep 07 |
nicklas |
54 |
public void setGCOSHeader(CHPFileHeader header) { gcosHeader = header; } |
11 |
13 Sep 07 |
nicklas |
55 |
|
11 |
13 Sep 07 |
nicklas |
/** The calvin object. */ |
11 |
13 Sep 07 |
nicklas |
57 |
private CHPData calvinData; |
11 |
13 Sep 07 |
nicklas |
58 |
|
11 |
13 Sep 07 |
nicklas |
/** Set the calvin object. |
11 |
13 Sep 07 |
nicklas |
* @param data The calvin object. |
11 |
13 Sep 07 |
nicklas |
61 |
*/ |
11 |
13 Sep 07 |
nicklas |
62 |
public void setCalvinObject(CHPData data) { calvinData = data; } |
11 |
13 Sep 07 |
nicklas |
63 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the number of columns of features. |
11 |
13 Sep 07 |
nicklas |
* @return The number of columns of features. |
11 |
13 Sep 07 |
nicklas |
66 |
*/ |
11 |
13 Sep 07 |
nicklas |
67 |
public int getCols() { |
11 |
13 Sep 07 |
nicklas |
68 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
69 |
return gcosHeader.getCols(); |
11 |
13 Sep 07 |
nicklas |
70 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
71 |
return calvinData.getCols(); |
11 |
13 Sep 07 |
nicklas |
72 |
return 0; |
11 |
13 Sep 07 |
nicklas |
73 |
} |
11 |
13 Sep 07 |
nicklas |
74 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the number of rows of features. |
11 |
13 Sep 07 |
nicklas |
* @return The number of rows of features. |
11 |
13 Sep 07 |
nicklas |
77 |
*/ |
11 |
13 Sep 07 |
nicklas |
78 |
public int getRows() { |
11 |
13 Sep 07 |
nicklas |
79 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
80 |
return gcosHeader.getRows(); |
11 |
13 Sep 07 |
nicklas |
81 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
82 |
return calvinData.getRows(); |
11 |
13 Sep 07 |
nicklas |
83 |
return 0; |
11 |
13 Sep 07 |
nicklas |
84 |
} |
11 |
13 Sep 07 |
nicklas |
85 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the number of probe sets. |
11 |
13 Sep 07 |
nicklas |
* @return The number of probe sets. |
11 |
13 Sep 07 |
nicklas |
88 |
*/ |
11 |
13 Sep 07 |
nicklas |
89 |
public int getNumProbeSets() { |
11 |
13 Sep 07 |
nicklas |
90 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
91 |
return gcosHeader.getNumProbeSets(); |
11 |
13 Sep 07 |
nicklas |
92 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
93 |
return calvinData.getEntryCount(); |
11 |
13 Sep 07 |
nicklas |
94 |
return 0; |
11 |
13 Sep 07 |
nicklas |
95 |
} |
11 |
13 Sep 07 |
nicklas |
96 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the assay type. |
11 |
13 Sep 07 |
nicklas |
* @return The assay type. |
11 |
13 Sep 07 |
nicklas |
99 |
*/ |
11 |
13 Sep 07 |
nicklas |
100 |
public int getAssayType() { |
11 |
13 Sep 07 |
nicklas |
101 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
102 |
return gcosHeader.getAssayType(); |
11 |
13 Sep 07 |
nicklas |
103 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
104 |
{ |
11 |
13 Sep 07 |
nicklas |
105 |
String str = calvinData.getAssayType(); |
11 |
13 Sep 07 |
nicklas |
106 |
if (str.compareTo(CHPData.CHP_EXPRESSION_ASSAY_TYPE) == 0) |
11 |
13 Sep 07 |
nicklas |
107 |
return EXPRESSION_ASSAY; |
11 |
13 Sep 07 |
nicklas |
108 |
if (str.compareTo(CHPData.CHP_GENOTYPING_ASSAY_TYPE) == 0) |
11 |
13 Sep 07 |
nicklas |
109 |
return GENOTYPING_ASSAY; |
11 |
13 Sep 07 |
nicklas |
110 |
if (str.compareTo(CHPData.CHP_UNIVERSAL_ASSAY_TYPE) == 0) |
11 |
13 Sep 07 |
nicklas |
111 |
return UNIVERSAL_ASSAY; |
11 |
13 Sep 07 |
nicklas |
112 |
if (str.compareTo(CHPData.CHP_RESEQUENCING_ASSAY_TYPE) == 0) |
11 |
13 Sep 07 |
nicklas |
113 |
return RESEQUENCING_ASSAY; |
11 |
13 Sep 07 |
nicklas |
114 |
} |
11 |
13 Sep 07 |
nicklas |
115 |
return UNKNOWN_ASSAY; |
11 |
13 Sep 07 |
nicklas |
116 |
} |
11 |
13 Sep 07 |
nicklas |
117 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the chip type. |
11 |
13 Sep 07 |
nicklas |
* @return The chip type. |
11 |
13 Sep 07 |
nicklas |
120 |
*/ |
11 |
13 Sep 07 |
nicklas |
121 |
public String getChipType() { |
11 |
13 Sep 07 |
nicklas |
122 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
123 |
return gcosHeader.getChipType(); |
11 |
13 Sep 07 |
nicklas |
124 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
125 |
return calvinData.getArrayType(); |
11 |
13 Sep 07 |
nicklas |
126 |
return null; |
11 |
13 Sep 07 |
nicklas |
127 |
} |
11 |
13 Sep 07 |
nicklas |
128 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the algorithm name. |
11 |
13 Sep 07 |
nicklas |
* @return The algorithm name. |
11 |
13 Sep 07 |
nicklas |
131 |
*/ |
11 |
13 Sep 07 |
nicklas |
132 |
public String getAlgName() { |
11 |
13 Sep 07 |
nicklas |
133 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
134 |
return gcosHeader.getAlgName(); |
11 |
13 Sep 07 |
nicklas |
135 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
136 |
return calvinData.getAlgName(); |
11 |
13 Sep 07 |
nicklas |
137 |
return null; |
11 |
13 Sep 07 |
nicklas |
138 |
} |
11 |
13 Sep 07 |
nicklas |
139 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the algorithm version. |
11 |
13 Sep 07 |
nicklas |
* @return The algorithm version. |
11 |
13 Sep 07 |
nicklas |
142 |
*/ |
11 |
13 Sep 07 |
nicklas |
143 |
public String getAlgVersion() { |
11 |
13 Sep 07 |
nicklas |
144 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
145 |
return gcosHeader.getAlgVersion(); |
11 |
13 Sep 07 |
nicklas |
146 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
147 |
return calvinData.getAlgVersion(); |
11 |
13 Sep 07 |
nicklas |
148 |
return null; |
11 |
13 Sep 07 |
nicklas |
149 |
} |
11 |
13 Sep 07 |
nicklas |
150 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the name of the CEL file used to create the CHP file. |
11 |
13 Sep 07 |
nicklas |
* @return The CEL file name. |
11 |
13 Sep 07 |
nicklas |
153 |
*/ |
11 |
13 Sep 07 |
nicklas |
154 |
public String getParentCellFile() { |
11 |
13 Sep 07 |
nicklas |
155 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
156 |
return gcosHeader.getParentCellFile(); |
11 |
13 Sep 07 |
nicklas |
157 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
158 |
return calvinData.getParentCell(); |
11 |
13 Sep 07 |
nicklas |
159 |
return null; |
11 |
13 Sep 07 |
nicklas |
160 |
} |
11 |
13 Sep 07 |
nicklas |
161 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the algorithm prog ID (COM components only). |
11 |
13 Sep 07 |
nicklas |
* @return The id. |
11 |
13 Sep 07 |
nicklas |
164 |
*/ |
11 |
13 Sep 07 |
nicklas |
165 |
public String getProgID() { |
11 |
13 Sep 07 |
nicklas |
166 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
167 |
return gcosHeader.getProgID(); |
11 |
13 Sep 07 |
nicklas |
168 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
169 |
return calvinData.getProgId(); |
11 |
13 Sep 07 |
nicklas |
170 |
return null; |
11 |
13 Sep 07 |
nicklas |
171 |
} |
11 |
13 Sep 07 |
nicklas |
172 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the algorithm parameters. |
11 |
13 Sep 07 |
nicklas |
* @return The parameters. |
11 |
13 Sep 07 |
nicklas |
175 |
*/ |
11 |
13 Sep 07 |
nicklas |
176 |
public Vector getAlgorithmParameters() { |
11 |
13 Sep 07 |
nicklas |
177 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
178 |
{ |
11 |
13 Sep 07 |
nicklas |
179 |
Vector gParams = gcosHeader.getAlgorithmParameters(); |
11 |
13 Sep 07 |
nicklas |
180 |
if (gParams == null) |
11 |
13 Sep 07 |
nicklas |
181 |
return null; |
11 |
13 Sep 07 |
nicklas |
182 |
int n = gParams.size(); |
11 |
13 Sep 07 |
nicklas |
183 |
Vector params = new Vector(); |
11 |
13 Sep 07 |
nicklas |
184 |
params.setSize(n); |
11 |
13 Sep 07 |
nicklas |
185 |
for (int i=0; i<n; i++) |
11 |
13 Sep 07 |
nicklas |
186 |
{ |
11 |
13 Sep 07 |
nicklas |
187 |
TagValuePair gparam = (TagValuePair) gParams.elementAt(i); |
11 |
13 Sep 07 |
nicklas |
188 |
FusionTagValuePair param = new FusionTagValuePair(); |
11 |
13 Sep 07 |
nicklas |
189 |
param.setTag(gparam.getTag()); |
11 |
13 Sep 07 |
nicklas |
190 |
param.setValue(gparam.getValue()); |
11 |
13 Sep 07 |
nicklas |
191 |
params.set(i, param); |
11 |
13 Sep 07 |
nicklas |
192 |
} |
11 |
13 Sep 07 |
nicklas |
193 |
return params; |
11 |
13 Sep 07 |
nicklas |
194 |
} |
11 |
13 Sep 07 |
nicklas |
195 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
196 |
{ |
11 |
13 Sep 07 |
nicklas |
197 |
Vector cParams = calvinData.getAlgParams(); |
11 |
13 Sep 07 |
nicklas |
198 |
if (cParams == null) |
11 |
13 Sep 07 |
nicklas |
199 |
return null; |
11 |
13 Sep 07 |
nicklas |
200 |
int n = cParams.size(); |
11 |
13 Sep 07 |
nicklas |
201 |
Vector params = new Vector(); |
11 |
13 Sep 07 |
nicklas |
202 |
params.setSize(n); |
11 |
13 Sep 07 |
nicklas |
203 |
for (int i=0; i<n; i++) |
11 |
13 Sep 07 |
nicklas |
204 |
{ |
11 |
13 Sep 07 |
nicklas |
205 |
ParameterNameValue cparam = (ParameterNameValue) cParams.elementAt(i); |
11 |
13 Sep 07 |
nicklas |
206 |
FusionTagValuePair param = new FusionTagValuePair(); |
11 |
13 Sep 07 |
nicklas |
207 |
param.setTag(cparam.getName()); |
11 |
13 Sep 07 |
nicklas |
208 |
param.setValue(cparam.toString()); |
11 |
13 Sep 07 |
nicklas |
209 |
param.setDetailed(cparam); |
11 |
13 Sep 07 |
nicklas |
210 |
params.set(i, param); |
11 |
13 Sep 07 |
nicklas |
211 |
} |
11 |
13 Sep 07 |
nicklas |
212 |
return params; |
11 |
13 Sep 07 |
nicklas |
213 |
} |
11 |
13 Sep 07 |
nicklas |
214 |
return null; |
11 |
13 Sep 07 |
nicklas |
215 |
} |
11 |
13 Sep 07 |
nicklas |
216 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the summary parameters. |
11 |
13 Sep 07 |
nicklas |
* @return The parameters. |
11 |
13 Sep 07 |
nicklas |
219 |
*/ |
11 |
13 Sep 07 |
nicklas |
220 |
public Vector getSummaryParameters() { |
11 |
13 Sep 07 |
nicklas |
221 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
222 |
{ |
11 |
13 Sep 07 |
nicklas |
223 |
Vector gParams = gcosHeader.getSummaryParameters(); |
11 |
13 Sep 07 |
nicklas |
224 |
if (gParams == null) |
11 |
13 Sep 07 |
nicklas |
225 |
return null; |
11 |
13 Sep 07 |
nicklas |
226 |
int n = gParams.size(); |
11 |
13 Sep 07 |
nicklas |
227 |
Vector params = new Vector(); |
11 |
13 Sep 07 |
nicklas |
228 |
params.setSize(n); |
11 |
13 Sep 07 |
nicklas |
229 |
for (int i=0; i<n; i++) |
11 |
13 Sep 07 |
nicklas |
230 |
{ |
11 |
13 Sep 07 |
nicklas |
231 |
TagValuePair gparam = (TagValuePair) gParams.elementAt(i); |
11 |
13 Sep 07 |
nicklas |
232 |
FusionTagValuePair param = new FusionTagValuePair(); |
11 |
13 Sep 07 |
nicklas |
233 |
param.setTag(gparam.getTag()); |
11 |
13 Sep 07 |
nicklas |
234 |
param.setValue(gparam.getValue()); |
11 |
13 Sep 07 |
nicklas |
235 |
params.set(i, param); |
11 |
13 Sep 07 |
nicklas |
236 |
} |
11 |
13 Sep 07 |
nicklas |
237 |
return params; |
11 |
13 Sep 07 |
nicklas |
238 |
} |
11 |
13 Sep 07 |
nicklas |
239 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
240 |
{ |
11 |
13 Sep 07 |
nicklas |
241 |
Vector cParams = calvinData.getChipSums(); |
11 |
13 Sep 07 |
nicklas |
242 |
if (cParams == null) |
11 |
13 Sep 07 |
nicklas |
243 |
return null; |
11 |
13 Sep 07 |
nicklas |
244 |
int n = cParams.size(); |
11 |
13 Sep 07 |
nicklas |
245 |
Vector params = new Vector(); |
11 |
13 Sep 07 |
nicklas |
246 |
params.setSize(n); |
11 |
13 Sep 07 |
nicklas |
247 |
for (int i=0; i<n; i++) |
11 |
13 Sep 07 |
nicklas |
248 |
{ |
11 |
13 Sep 07 |
nicklas |
249 |
ParameterNameValue cparam = (ParameterNameValue) cParams.elementAt(i); |
11 |
13 Sep 07 |
nicklas |
250 |
FusionTagValuePair param = new FusionTagValuePair(); |
11 |
13 Sep 07 |
nicklas |
251 |
param.setTag(cparam.getName()); |
11 |
13 Sep 07 |
nicklas |
252 |
param.setValue(cparam.toString()); |
11 |
13 Sep 07 |
nicklas |
253 |
param.setDetailed(cparam); |
11 |
13 Sep 07 |
nicklas |
254 |
params.set(i, param); |
11 |
13 Sep 07 |
nicklas |
255 |
} |
11 |
13 Sep 07 |
nicklas |
256 |
return params; |
11 |
13 Sep 07 |
nicklas |
257 |
} |
11 |
13 Sep 07 |
nicklas |
258 |
return null; |
11 |
13 Sep 07 |
nicklas |
259 |
} |
11 |
13 Sep 07 |
nicklas |
260 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the background zone information. |
11 |
13 Sep 07 |
nicklas |
* @return The background information. |
11 |
13 Sep 07 |
nicklas |
263 |
*/ |
11 |
13 Sep 07 |
nicklas |
264 |
public BackgroundZoneInfo getBackgroundZoneInfo() { |
11 |
13 Sep 07 |
nicklas |
265 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
266 |
return gcosHeader.getBackgroundZoneInfo(); |
11 |
13 Sep 07 |
nicklas |
267 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
268 |
{ |
11 |
13 Sep 07 |
nicklas |
269 |
CHPBackgroundZone calvinZone = new CHPBackgroundZone(); |
11 |
13 Sep 07 |
nicklas |
270 |
BackgroundZoneInfo info = new BackgroundZoneInfo(); |
11 |
13 Sep 07 |
nicklas |
271 |
int n = calvinData.getBackgroundZoneCnt(); |
11 |
13 Sep 07 |
nicklas |
272 |
for (int i=0; i<n; i++) |
11 |
13 Sep 07 |
nicklas |
273 |
{ |
11 |
13 Sep 07 |
nicklas |
274 |
calvinData.getBackgroundZone(i, calvinZone); |
11 |
13 Sep 07 |
nicklas |
275 |
info.setSmoothFactor(calvinZone.getSmoothFactor()); |
11 |
13 Sep 07 |
nicklas |
276 |
BackgroundZoneType zone = new BackgroundZoneType(); |
11 |
13 Sep 07 |
nicklas |
277 |
zone.setBackground(calvinZone.getBackground()); |
11 |
13 Sep 07 |
nicklas |
278 |
zone.setCenterX(calvinZone.getCenterX()); |
11 |
13 Sep 07 |
nicklas |
279 |
zone.setCenterY(calvinZone.getCenterY()); |
11 |
13 Sep 07 |
nicklas |
280 |
info.addZone(zone); |
11 |
13 Sep 07 |
nicklas |
281 |
} |
11 |
13 Sep 07 |
nicklas |
282 |
return info; |
11 |
13 Sep 07 |
nicklas |
283 |
} |
11 |
13 Sep 07 |
nicklas |
284 |
return null; |
11 |
13 Sep 07 |
nicklas |
285 |
} |
11 |
13 Sep 07 |
nicklas |
286 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets a specific algorithm parameter given a name/tag |
11 |
13 Sep 07 |
nicklas |
* @return The specific algorithm parameter given a name/tag |
11 |
13 Sep 07 |
nicklas |
289 |
*/ |
11 |
13 Sep 07 |
nicklas |
290 |
public String getAlgorithmParameter(String tag) { |
11 |
13 Sep 07 |
nicklas |
291 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
292 |
return gcosHeader.getAlgorithmParameter(tag); |
11 |
13 Sep 07 |
nicklas |
293 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
294 |
{ |
11 |
13 Sep 07 |
nicklas |
295 |
ParameterNameValue nvt = calvinData.getAlgParam(tag); |
11 |
13 Sep 07 |
nicklas |
296 |
if (nvt != null) |
11 |
13 Sep 07 |
nicklas |
297 |
return nvt.toString(); |
11 |
13 Sep 07 |
nicklas |
298 |
} |
11 |
13 Sep 07 |
nicklas |
299 |
return null; |
11 |
13 Sep 07 |
nicklas |
300 |
} |
11 |
13 Sep 07 |
nicklas |
301 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets a specific summary parameter given a name/tag |
11 |
13 Sep 07 |
nicklas |
* @return The specific summary parameter given a name/tag |
11 |
13 Sep 07 |
nicklas |
304 |
*/ |
11 |
13 Sep 07 |
nicklas |
305 |
public String getSummaryParameter(String tag) { |
11 |
13 Sep 07 |
nicklas |
306 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
307 |
return gcosHeader.getSummaryParameter(tag); |
11 |
13 Sep 07 |
nicklas |
308 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
309 |
{ |
11 |
13 Sep 07 |
nicklas |
310 |
ParameterNameValue nvt = calvinData.getChipSum(tag); |
11 |
13 Sep 07 |
nicklas |
311 |
if (nvt != null) |
11 |
13 Sep 07 |
nicklas |
312 |
return nvt.toString(); |
11 |
13 Sep 07 |
nicklas |
313 |
} |
11 |
13 Sep 07 |
nicklas |
314 |
return null; |
11 |
13 Sep 07 |
nicklas |
315 |
} |
11 |
13 Sep 07 |
nicklas |
316 |
|
11 |
13 Sep 07 |
nicklas |
/** Gets the background value for a given center coordinate |
11 |
13 Sep 07 |
nicklas |
* @return The background value for a given center coordinate |
11 |
13 Sep 07 |
nicklas |
319 |
*/ |
11 |
13 Sep 07 |
nicklas |
320 |
public BackgroundZoneType getBackgroundZone(int x, int y) { |
11 |
13 Sep 07 |
nicklas |
321 |
if (gcosHeader != null) |
11 |
13 Sep 07 |
nicklas |
322 |
return gcosHeader.getBackgroundZone(x, y); |
11 |
13 Sep 07 |
nicklas |
323 |
else if (calvinData != null) |
11 |
13 Sep 07 |
nicklas |
324 |
{ |
11 |
13 Sep 07 |
nicklas |
325 |
CHPBackgroundZone zn = new CHPBackgroundZone(); |
11 |
13 Sep 07 |
nicklas |
326 |
int n = calvinData.getBackgroundZoneCnt(); |
11 |
13 Sep 07 |
nicklas |
327 |
for (int i=0; i<n; i++) |
11 |
13 Sep 07 |
nicklas |
328 |
{ |
11 |
13 Sep 07 |
nicklas |
329 |
calvinData.getBackgroundZone(i, zn); |
11 |
13 Sep 07 |
nicklas |
330 |
if (Float.compare(zn.getCenterX(), x) == 0 && Float.compare(zn.getCenterY(), y) == 0) |
11 |
13 Sep 07 |
nicklas |
331 |
{ |
11 |
13 Sep 07 |
nicklas |
332 |
BackgroundZoneType bg = new BackgroundZoneType(); |
11 |
13 Sep 07 |
nicklas |
333 |
bg.setBackground(zn.getBackground()); |
11 |
13 Sep 07 |
nicklas |
334 |
bg.setCenterX((int)zn.getCenterX()); |
11 |
13 Sep 07 |
nicklas |
335 |
bg.setCenterY((int)zn.getCenterY()); |
11 |
13 Sep 07 |
nicklas |
336 |
return bg; |
11 |
13 Sep 07 |
nicklas |
337 |
} |
11 |
13 Sep 07 |
nicklas |
338 |
} |
11 |
13 Sep 07 |
nicklas |
339 |
} |
11 |
13 Sep 07 |
nicklas |
340 |
return null; |
11 |
13 Sep 07 |
nicklas |
341 |
} |
11 |
13 Sep 07 |
nicklas |
342 |
|
11 |
13 Sep 07 |
nicklas |
/** Creates a new instance of FusionCHPHeader */ |
11 |
13 Sep 07 |
nicklas |
344 |
public FusionCHPHeader() { |
11 |
13 Sep 07 |
nicklas |
345 |
gcosHeader = null; |
11 |
13 Sep 07 |
nicklas |
346 |
calvinData = null; |
11 |
13 Sep 07 |
nicklas |
347 |
} |
11 |
13 Sep 07 |
nicklas |
348 |
} |