1 package gov.sandia.geotess.examples.customdata;
3 import java.io.DataInputStream;
4 import java.io.DataOutputStream;
5 import java.io.IOException;
6 import java.util.Collection;
7 import java.util.HashMap;
10 import java.util.Scanner;
16 import gov.
sandia.gmp.util.globals.DataType;
25 public class GridPointData extends DataCustom implements Map<String, StationData>
71 this.dataValues =
new HashMap<String, StationData>(model.
stationNames.length);
82 this.cellRadius = cellRadius;
83 this.minDepth = minDepth;
84 this.maxDepth = maxDepth;
95 cellRadius = input.nextDouble();
96 minDepth = input.nextDouble();
97 maxDepth = input.nextDouble();
98 int nStations = input.nextInt();
99 for (
int i=0; i<nStations; ++i)
101 String station = input.next();
117 cellRadius = input.readDouble();
118 minDepth = input.readDouble();
119 maxDepth = input.readDouble();
120 int nStations = input.readInt();
121 for (
int i=0; i<nStations; ++i)
123 String station = GeoTessUtils.readString(input);
130 public void write(DataOutputStream output)
throws IOException {
131 output.writeDouble(cellRadius);
132 output.writeDouble(minDepth);
133 output.writeDouble(maxDepth);
135 for (Entry<String, StationData> entry :
dataValues.entrySet())
137 GeoTessUtils.writeString(output, entry.getKey());
149 StringBuffer output =
new StringBuffer();
150 output.append(String.format(
"%1.6f %1.6f %1.6f%n", cellRadius, minDepth, maxDepth));
151 output.append(String.format(
"%d%n",
dataValues.size()));
152 for (Entry<String, StationData> e1 :
dataValues.entrySet())
154 output.append(e1.getKey()+
'\n');
157 return output.toString();
165 this.cellRadius = cellRadius;
173 this.minDepth = minDepth;
181 this.maxDepth = maxDepth;
226 throw new UnsupportedOperationException();
231 return this.getClass().getSimpleName();
236 return DataType.DOUBLE;
252 if (s ==
null)
return Double.NaN;
254 if (p ==
null)
return Double.NaN;
255 Double a = p.get(map.attribute);
256 if (a ==
null)
return Double.NaN;
257 return a.doubleValue();
261 public Data
setValue(
int attributeIndex,
double value) {
266 if (phaseMap !=
null)
268 PhaseData attributeMap = phaseMap.get(map.phase);
269 if (attributeMap !=
null)
270 attributeMap.put(map.attribute, value);
286 throw new UnsupportedOperationException();
291 throw new UnsupportedOperationException();
296 throw new UnsupportedOperationException();
301 throw new UnsupportedOperationException();
306 throw new UnsupportedOperationException();
310 public Data
setValue(
int attributeIndex,
float value) {
311 throw new UnsupportedOperationException();
315 public Data
setValue(
int attributeIndex,
long value) {
316 throw new UnsupportedOperationException();
320 public Data
setValue(
int attributeIndex,
int value) {
321 throw new UnsupportedOperationException();
325 public Data
setValue(
int attributeIndex,
short value) {
326 throw new UnsupportedOperationException();
330 public Data
setValue(
int attributeIndex,
byte value) {
331 throw new UnsupportedOperationException();
335 public Data
fill(Number fillValue) {
336 throw new UnsupportedOperationException();
382 public Collection<StationData>
values() {
387 public Set<Entry<String, StationData>>
entrySet() {
392 public void putAll(Map<? extends String, ? extends StationData> m) {