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 / expansionadapter / MemoryExpansionAdapter.java @ 40559

History | View | Annotate | Download (3.05 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.expansionadapter;
25

    
26
import java.util.ArrayList;
27
import java.util.HashMap;
28
import java.util.Iterator;
29
import java.util.List;
30

    
31

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

    
40
        public MemoryExpansionAdapter(){
41
        }
42

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

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

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

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

    
74
        }
75

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

    
82
        }
83

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

    
90
        }
91

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

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

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