Statistics
| Revision:

gvsig-raster / org.gvsig.raster.georeferencing / trunk / org.gvsig.raster.georeferencing / org.gvsig.raster.georeferencing.swing / org.gvsig.raster.georeferencing.swing.impl / src / main / java / org / gvsig / raster / georeferencing / swing / impl / view / ViewRecord.java @ 1752

History | View | Annotate | Download (1.68 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.georeferencing.swing.impl.view;
23

    
24
import java.util.ArrayList;
25
import java.util.List;
26

    
27
/**
28
 * Historial de peticiones para poder recuperar las anteriores a 
29
 * la actual.
30
 * 
31
 * 11/01/2008
32
 * @author Nacho Brodin (nachobrodin@gmail.com)
33
 */
34
public class ViewRecord {
35

    
36
        private List<Object>    record = new ArrayList<Object>();
37
        private int             pos    = -1;
38

    
39
        /**
40
         * Asigna la petici?n siguiente
41
         * @param request
42
         */
43
        public void setRequest(Object request) {
44
                record.add(++ pos, request);
45
        }
46
        
47
        /**
48
         * Obtiene la petici?n anterior
49
         * @return
50
         */
51
        public Object getRequest() {
52
                if(pos > 0) {
53
                        pos --;
54
                        return record.get(pos);
55
                } else if(pos == 0)
56
                        return record.get(pos);
57
                return null;
58
        }
59
        
60
        /**
61
         * Vacia el historial
62
         */
63
        public void clear() {
64
                record.clear();
65
        }
66
}