Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / buffer / cache / PageBandBuffer.java @ 27361

History | View | Annotate | Download (2.54 KB)

1

    
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 */
20
package org.gvsig.raster.buffer.cache;
21

    
22
import java.io.IOException;
23

    
24
import org.gvsig.raster.buffer.RasterMemoryBuffer;
25

    
26
/**
27
 * Esta clase representa una p?gina de cache. Una p?gina no es m?s que un buffer de datos
28
 * con todas sus funcionalidades con un uso especifico, el de ser una p?gina. 
29
 * 
30
 * @author Nacho Brodin (nachobrodin@gmail.com)
31
 *
32
 */
33
public class PageBandBuffer extends RasterMemoryBuffer{
34

    
35
        /**
36
         * N?mero de banda que corresponde a este PageBandBuffer
37
         */
38
        private int numBand = 0;
39
        private HddPage[] hddPages = null;
40
        
41
        /**
42
         * Constructor.
43
         * @param dataType Tipo de dato
44
         * @param width Ancho de p?gina
45
         * @param height Alto de p?gina
46
         * @param bandNr N?mero de bandas
47
         * @param malloc true para reservar de memoria en el buffer 
48
         */
49
        public PageBandBuffer(int dataType, int width, int height, int bandNr, boolean malloc, int numBand){
50
                super(dataType, width, height, bandNr, malloc);
51
                this.numBand = numBand;
52
        }
53
        
54
        /**
55
         * Asigna la lista de paginas de disco
56
         * @param hddList Lista de p?ginas de disco
57
         */
58
        public void setHddPages(HddPage[] hddList){
59
                this.hddPages = hddList;
60
        }
61
        
62
        /**
63
         * Carga una p?gina especificada en el par?metro nPag con los datos necesarios.
64
         * Para esto utiliza el dataSource.
65
         *   
66
         * @param nPag N?mero de p?gina a cargar
67
         */
68
        public void loadPage(int nPag) throws InterruptedException{
69
                hddPages[nPag].getDataServer(numBand).loadPage(this);
70
        }
71
        
72
        /**
73
         * Salva una p?gina especificada en el par?metro nPag a disco. 
74
         * Para esto utiliza el dataSource
75
         *   
76
         * @param nPag N?mero de p?gina a salvar
77
         * @throws IOException
78
         */
79
        public void savePage(int nPag) throws IOException, InterruptedException {
80
                hddPages[nPag].getDataServer(numBand).savePage(this);
81
        }
82

    
83
}