Statistics
| Revision:

gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.impl / deprecated / buffer / impl / stripecache / CacheBand.java @ 1939

History | View | Annotate | Download (7.88 KB)

1
package org.gvsig.raster.cache.buffer.impl.stripecache;
2

    
3
import org.gvsig.raster.cache.buffer.exception.InvalidPageNumberException;
4
import org.gvsig.raster.cache.buffer.exception.OperationNotSupportedException;
5
import org.gvsig.raster.cache.buffer.impl.BandImpl;
6

    
7

    
8
/**
9
 * Clase base para las bandas de un RasterMemoryBuffer.
10
 * 
11
 * @author Nacho Brodin (nachobrodin@gmail.com)
12
 */
13
public abstract class CacheBand extends BandImpl {        
14
        protected Cache            cache          = null;
15
        protected LRUAlgorithm     lru            = null;
16
        /**
17
         * Band number in the list of the raster
18
         */
19
        protected int              nBand          = -1;
20
        private int                lastLine       = -1;
21
        
22
    /**
23
     * Constructor a llamar desde las clases hijas
24
     */
25
    public CacheBand(Cache cache, LRUAlgorithm lru, int nBand) {
26
            super(        cache.getDataSourceWidth(), 
27
                            cache.getDataSourceHeight());
28
            this.cache = cache;
29
            this.lru = lru;
30
            this.nBand = nBand;
31
    }
32
           
33
        /*
34
         * (non-Javadoc)
35
         * @see org.gvsig.raster.buffer.IRasterBand#getBlockHeight()
36
         */
37
        public int getBlockSize() {
38
                return cache.getHPag();
39
        }
40
        
41
        /**
42
         * Get associated cache
43
         * @return Cache
44
         */
45
        public Cache getCache() {
46
                return cache;
47
        }
48
        
49
        /**
50
         * Set associated cache
51
         * @param Cache
52
         */
53
        public void setCache(Cache cache) {
54
                this.cache = cache;
55
        }
56
        
57
        /**
58
         * Get LruAlgorithm class associated
59
         * @return LRUAlgorithm
60
         */
61
        public LRUAlgorithm getLruAlgorithm() {
62
                return lru;
63
        }
64

    
65
        /**
66
         * Set LruAlgorithm class associated
67
         * @param LRUAlgorithmVertImpl
68
         */
69
        public void setLruAlgorithm(LRUAlgorithm lru) {
70
                this.lru = lru;
71
        }
72
        
73
        /*
74
         * (non-Javadoc)
75
         * @see org.gvsig.raster.buffer.IRasterBand#setBandNumber(int)
76
         */
77
        public void setBandNumber(int band) {
78
                this.nBand = band;
79
        }
80
        
81
        /*
82
         * (non-Javadoc)
83
         * @see org.gvsig.raster.buffer.IRasterBand#getBandNumber()
84
         */
85
        public int getBandNumber() {
86
                return this.nBand;
87
        }
88
        
89
        protected boolean exists(int line) {
90
        // Store the last line checked so we don't check it again for each
91
        // pixel of the same line
92
        if (line != lastLine) {
93
            try {
94
                lru.cacheAccess(line, false);
95
                this.lastLine = line;
96
            } catch (InvalidPageNumberException e) {
97
                return false;
98
            } catch (InterruptedException e) {
99
                                return false;
100
                        }
101
        }
102
        return true;
103
    }
104
                
105
        //***********************************************
106
    //Getting a block of data
107
        
108
    /*
109
     * (non-Javadoc)
110
     * @see org.gvsig.raster.buffer.IRasterBand#getByteBlock(int)
111
     */
112
        public byte[][] getByteBlock(int block){
113
                return null;
114
        }
115
        
116
        /*
117
         * (non-Javadoc)
118
         * @see org.gvsig.raster.buffer.IRasterBand#getShortBlock(int)
119
         */
120
        public short[][] getShortBlock(int block){
121
                return null;
122
        }
123
        
124
        /*
125
         * (non-Javadoc)
126
         * @see org.gvsig.raster.buffer.IRasterBand#getIntBlock(int)
127
         */
128
        public int[][] getIntBlock(int block){
129
                return null;
130
        }
131
        
132
        /*
133
         * (non-Javadoc)
134
         * @see org.gvsig.raster.buffer.IRasterBand#getFloatBlock(int)
135
         */
136
        public float[][] getFloatBlock(int block){
137
                return null;
138
        }
139
        
140
        /*
141
         * (non-Javadoc)
142
         * @see org.gvsig.raster.buffer.IRasterBand#getDoubleBlock(int)
143
         */
144
        public double[][] getDoubleBlock(int block){
145
                return null;
146
        }
147

    
148
        /*
149
         * (non-Javadoc)
150
         * @see org.gvsig.raster.buffer.IRasterBand#assign(byte)
151
         */
152
        public void assign(byte value) {}
153

    
154
        /*
155
         * (non-Javadoc)
156
         * @see org.gvsig.raster.buffer.IRasterBand#assign(short)
157
         */
158
        public void assign(short value) {}
159

    
160
        /*
161
         * (non-Javadoc)
162
         * @see org.gvsig.raster.buffer.IRasterBand#assign(int)
163
         */
164
        public void assign(int value) {}
165

    
166
        /*
167
         * (non-Javadoc)
168
         * @see org.gvsig.raster.buffer.IRasterBand#assign(float)
169
         */
170
        public void assign(float value) {}
171

    
172
        /*
173
         * (non-Javadoc)
174
         * @see org.gvsig.raster.buffer.IRasterBand#assign(double)
175
         */
176
        public void assign(double value) {}
177

    
178
        /*
179
         * (non-Javadoc)
180
         * @see org.gvsig.raster.buffer.IRasterBand#getElemByte(int, int)
181
         */
182
        public byte getElemByte(int line, int col) {
183
                return 0;
184
        }
185

    
186
        /*
187
         * (non-Javadoc)
188
         * @see org.gvsig.raster.buffer.IRasterBand#getElemDouble(int, int)
189
         */
190
        public double getElemDouble(int line, int col) {
191
                return 0;
192
        }
193
        
194
        /*
195
         * (non-Javadoc)
196
         * @see org.gvsig.raster.buffer.IRasterBand#getElemFloat(int, int)
197
         */
198
        public float getElemFloat(int line, int col) {
199
                return 0;
200
        }
201

    
202
        /*
203
         * (non-Javadoc)
204
         * @see org.gvsig.raster.buffer.IRasterBand#getElemInt(int, int)
205
         */
206
        public int getElemInt(int line, int col) {
207
                return 0;
208
        }
209

    
210
        /*
211
         * (non-Javadoc)
212
         * @see org.gvsig.raster.buffer.IRasterBand#getElemShort(int, int)
213
         */
214
        public short getElemShort(int line, int col) {
215
                return 0;
216
        }
217
        
218
        /*
219
         * (non-Javadoc)
220
         * @see org.gvsig.raster.buffer.IRasterBand#getByteLine(int)
221
         */
222
        public byte[] getByteLine(int line) throws OperationNotSupportedException {
223
                return null;
224
        }
225

    
226
        /*
227
         * (non-Javadoc)
228
         * @see org.gvsig.raster.buffer.IRasterBand#getDoubleLine(int)
229
         */
230
        public double[] getDoubleLine(int line) throws OperationNotSupportedException {
231
                return null;
232
        }
233
        
234
        /*
235
         * (non-Javadoc)
236
         * @see org.gvsig.raster.buffer.IRasterBand#getFloatLine(int)
237
         */
238
        public float[] getFloatLine(int line) throws OperationNotSupportedException {
239
                return null;
240
        }
241

    
242
        /*
243
         * (non-Javadoc)
244
         * @see org.gvsig.raster.buffer.IRasterBand#getIntLine(int)
245
         */
246
        public int[] getIntLine(int line) throws OperationNotSupportedException {
247
                return null;
248
        }
249

    
250
        /*
251
         * (non-Javadoc)
252
         * @see org.gvsig.raster.buffer.IRasterBand#getShortLine(int)
253
         */
254
        public short[] getShortLine(int line) throws OperationNotSupportedException {
255
                return null;
256
        }
257

    
258
        /*
259
         * (non-Javadoc)
260
         * @see org.gvsig.raster.buffer.IRasterBand#setElem(int, int, byte)
261
         */
262
        public void setElem(int line, int col, byte data) {}
263

    
264
        /*
265
         * (non-Javadoc)
266
         * @see org.gvsig.raster.buffer.IRasterBand#setElem(int, int, short)
267
         */
268
        public void setElem(int line, int col, short data) {}
269

    
270
        /*
271
         * (non-Javadoc)
272
         * @see org.gvsig.raster.buffer.IRasterBand#setElem(int, int, int)
273
         */
274
        public void setElem(int line, int col, int data) {}
275

    
276
        /*
277
         * (non-Javadoc)
278
         * @see org.gvsig.raster.buffer.IRasterBand#setElem(int, int, float)
279
         */
280
        public void setElem(int line, int col, float data) {}
281

    
282
        /*
283
         * (non-Javadoc)
284
         * @see org.gvsig.raster.buffer.IRasterBand#setElem(int, int, double)
285
         */
286
        public void setElem(int line, int col, double data) {}
287

    
288
        /*
289
         * (non-Javadoc)
290
         * @see org.gvsig.raster.buffer.IRasterBand#setByteLine(byte[], int)
291
         */
292
        public void setByteLine(byte[] data, int line) throws OperationNotSupportedException {}
293

    
294
        /*
295
         * (non-Javadoc)
296
         * @see org.gvsig.raster.buffer.IRasterBand#setDoubleLine(double[], int)
297
         */
298
        public void setDoubleLine(double[] data, int line) throws OperationNotSupportedException {}
299
                
300
        /*
301
         * (non-Javadoc)
302
         * @see org.gvsig.raster.buffer.IRasterBand#setFloatLine(float[], int)
303
         */
304
        public void setFloatLine(float[] data, int line) {}
305

    
306
        /*
307
         * (non-Javadoc)
308
         * @see org.gvsig.raster.buffer.IRasterBand#setIntLine(int[], int)
309
         */
310
        public void setIntLine(int[] data, int line) throws OperationNotSupportedException {}
311

    
312
        /*
313
         * (non-Javadoc)
314
         * @see org.gvsig.raster.buffer.IRasterBand#setShortLine(short[], int)
315
         */
316
        public void setShortLine(short[] data, int line) throws OperationNotSupportedException {}
317
        
318
        /*
319
         * (non-Javadoc)
320
         * @see org.gvsig.raster.buffer.IRasterBand#setByteBlock(byte[][], int)
321
         */
322
        public void setByteBlock(byte[][] data, int block) {}
323
        
324
        /*
325
         * (non-Javadoc)
326
         * @see org.gvsig.raster.buffer.IRasterBand#setShortBlock(short[][], int)
327
         */
328
        public void setShortBlock(short[][] data, int block) {}
329
        
330
        /*
331
         * (non-Javadoc)
332
         * @see org.gvsig.raster.buffer.IRasterBand#setIntBlock(int[][], int)
333
         */
334
        public void setIntBlock(int[][] data, int block) {}
335
        
336
        /*
337
         * (non-Javadoc)
338
         * @see org.gvsig.raster.buffer.IRasterBand#setFloatBlock(float[][], int)
339
         */
340
        public void setFloatBlock(float[][] data, int block) {}
341
        
342
        /*
343
         * (non-Javadoc)
344
         * @see org.gvsig.raster.buffer.IRasterBand#setDoubleBlock(double[][], int)
345
         */
346
        public void setDoubleBlock(double[][] data, int block) {}
347

    
348
}