Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / fmap / dal / feature / impl / editing / memory / MemoryExpansionAdapter.java @ 43840

History | View | Annotate | Download (3.12 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.dal.feature.impl.editing.memory;
25

    
26
import org.gvsig.fmap.dal.feature.impl.editing.memory.ExpansionAdapter;
27
import java.util.ArrayList;
28
import java.util.HashMap;
29
import java.util.Iterator;
30
import java.util.List;
31

    
32

    
33
/**
34
 * Implementaci?n en memoria de ExpansionAdapter.
35
 *
36
 * @author Vicente Caballero Navarro
37
 */
38
public class MemoryExpansionAdapter implements ExpansionAdapter {
39
        private List objects = new ArrayList();
40

    
41
        public MemoryExpansionAdapter(){
42
        }
43

    
44
        /* (non-Javadoc)
45
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#addFeature(org.gvsig.fmap.dal.feature.Feature)
46
         */
47
        public int addObject(Object obj) {
48
//                Feature feature=(Feature)obj;
49
                int newIndex = objects.size();
50
                objects.add(obj);
51
                return newIndex;
52
        }
53

    
54
//        /* (non-Javadoc)
55
//         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#modifyFeature(int, org.gvsig.fmap.dal.feature.Feature)
56
//         */
57
//        public int updateObject(Object obj) {
58
////                Feature feature=(Feature)obj;
59
//                objects.add(obj);
60
//                return objects.size() - 1;
61
//        }
62

    
63
        /* (non-Javadoc)
64
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#getFeature(int)
65
         */
66
        public Object getObject(int index){
67
                return objects.get(index);
68
        }
69

    
70
        /* (non-Javadoc)
71
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#compact(java.util.HashMap)
72
         */
73
        public void compact(HashMap relations) {
74

    
75
        }
76

    
77
        /* (non-Javadoc)
78
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#deleteLastFeature()
79
         */
80
        public void deleteLastObject() {
81
                objects.remove(objects.size()-1);
82

    
83
        }
84

    
85
        /* (non-Javadoc)
86
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#open()
87
         */
88
        public void open() {
89
                // TODO Auto-generated method stub
90

    
91
        }
92

    
93
        /* (non-Javadoc)
94
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#close()
95
         */
96
        public void close() {
97
                objects.clear();
98
        }
99

    
100
        /* (non-Javadoc)
101
         * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#getSize()
102
         */
103
        public int getSize() {
104
                return objects.size();
105
        }
106

    
107
        public Iterator iterator() {
108
                return objects.iterator();
109
        }
110
}