Revision 43873 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.bsq/src/main/java/org/gvsig/fmap/dal/fileutils/impl/DefaultSTXFile.java

View differences:

DefaultSTXFile.java
21 21

  
22 22
    private File source;
23 23
    private List<STXBand> bands;
24
    
24

  
25 25
    public static class DefaultSTXBand implements STXBand {
26
        
26

  
27 27
        private int band;
28 28
        private double minimum;
29 29
        private double maximum;
......
31 31
        private double std_deviation; // Optional
32 32
        private double linear_stretch_min; // Optional
33 33
        private double linear_stretch_max; // Optional
34
 
34

  
35 35
        private boolean valid = false;
36
        
36

  
37 37
        public DefaultSTXBand() {
38
            
38

  
39 39
        }
40 40

  
41 41
        public DefaultSTXBand(
42
            int band, 
43
            double minimum, 
44
            double maximum, 
45
            double mean, 
46
            double std_deviation, 
47
            double linear_stretch_min, 
42
            int band,
43
            double minimum,
44
            double maximum,
45
            double mean,
46
            double std_deviation,
47
            double linear_stretch_min,
48 48
            double linear_stretch_max
49 49
            ) {
50 50
            this();
......
56 56
            this.linear_stretch_min = linear_stretch_min;
57 57
            this.linear_stretch_max = linear_stretch_max;
58 58
        }
59
        
59

  
60 60
        @SuppressWarnings("OverridableMethodCallInConstructor")
61 61
        public DefaultSTXBand(String line) {
62 62
            this();
63 63
            this.parse(line);
64 64
        }
65
       
65

  
66 66
        @Override
67 67
        public void parse(String line) {
68 68
            valid = false;
......
70 70
            if( words.length < 7 ) {
71 71
                throw new IllegalArgumentException("At least 7 parameters are needed ("+line+").");
72 72
            }
73
            this.band = Integer.parseUnsignedInt(words[0]);
73
            this.band = Integer.parseInt(words[0]);
74 74
            this.minimum = Double.parseDouble(words[1]);
75 75
            this.maximum = Double.parseDouble(words[2]);
76 76
            if( "#".equals(words[3]) ) {
......
124 124
            }
125 125
            return builder.toString();
126 126
        }
127
        
127

  
128 128
        @Override
129 129
        public int getBand() {
130 130
            return band;
......
176 176
        this();
177 177
        this.read(file);
178 178
    }
179
    
179

  
180 180
    @Override
181 181
    public File getFile(File file) {
182 182
        File f = new File(FilenameUtils.removeExtension(file.getAbsolutePath())+"."+FILE_EXTENSION);
183 183
        return f;
184 184
    }
185
    
185

  
186 186
    @Override
187 187
    public File getFile() {
188 188
        return source;
......
207 207
                                    + "' (lineno=+" + lineno
208 208
                                    + ", file=" + f.getAbsoluteFile()
209 209
                                    + ").", e);
210
                            
210

  
211 211
                        }
212 212
                    }
213 213
                }
......
222 222
    public List<STXBand> getBands() {
223 223
        return this.bands;
224 224
    }
225
    
225

  
226 226
    @Override
227 227
    public void clear() {
228 228
        this.bands = new ArrayList<>();
229 229
    }
230
    
230

  
231 231
    @Override
232 232
    public void addBand(
233
            int band, 
234
            double minimum, 
235
            double maximum, 
236
            double mean, 
237
            double std_deviation, 
238
            double linear_stretch_min, 
233
            int band,
234
            double minimum,
235
            double maximum,
236
            double mean,
237
            double std_deviation,
238
            double linear_stretch_min,
239 239
            double linear_stretch_max
240 240
        ) {
241 241
        DefaultSTXBand b = new DefaultSTXBand(band, minimum, maximum, mean, std_deviation, linear_stretch_min, linear_stretch_max);

Also available in: Unified diff