root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / impl / expansionadapter / MemoryExpansionAdapter.java @ 24496
History | View | Annotate | Download (3.22 KB)
1 | 19399 | vcaballero | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
4 | *
|
||
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | *
|
||
19 | * For more information, contact:
|
||
20 | *
|
||
21 | * Generalitat Valenciana
|
||
22 | * Conselleria d'Infraestructures i Transport
|
||
23 | * Av. Blasco Ib??ez, 50
|
||
24 | * 46010 VALENCIA
|
||
25 | * SPAIN
|
||
26 | *
|
||
27 | * +34 963862235
|
||
28 | * gvsig@gva.es
|
||
29 | * www.gvsig.gva.es
|
||
30 | *
|
||
31 | * or
|
||
32 | *
|
||
33 | * IVER T.I. S.A
|
||
34 | * Salamanca 50
|
||
35 | * 46005 Valencia
|
||
36 | * Spain
|
||
37 | *
|
||
38 | * +34 963163400
|
||
39 | * dac@iver.es
|
||
40 | */
|
||
41 | 24496 | jmvivo | package org.gvsig.fmap.dal.feature.impl.expansionadapter; |
42 | 19399 | vcaballero | |
43 | import java.util.ArrayList; |
||
44 | import java.util.HashMap; |
||
45 | |||
46 | |||
47 | /**
|
||
48 | * Implementaci?n en memoria de ExpansionAdapter.
|
||
49 | *
|
||
50 | * @author Vicente Caballero Navarro
|
||
51 | */
|
||
52 | 21045 | jmvivo | public class MemoryExpansionAdapter implements ExpansionAdapter { |
53 | 19399 | vcaballero | private ArrayList objects = new ArrayList(); |
54 | |||
55 | public MemoryExpansionAdapter(){
|
||
56 | } |
||
57 | |||
58 | /* (non-Javadoc)
|
||
59 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#addFeature(org.gvsig.fmap.dal.feature.Feature)
|
60 | 19399 | vcaballero | */
|
61 | public int addObject(Object obj) { |
||
62 | 21045 | jmvivo | // Feature feature=(Feature)obj;
|
63 | 19399 | vcaballero | int newIndex = objects.size();
|
64 | objects.add(obj); |
||
65 | return newIndex;
|
||
66 | } |
||
67 | |||
68 | 24135 | vcaballero | // /* (non-Javadoc)
|
69 | 24496 | jmvivo | // * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#modifyFeature(int, org.gvsig.fmap.dal.feature.Feature)
|
70 | 24135 | vcaballero | // */
|
71 | // public int updateObject(Object obj) {
|
||
72 | //// Feature feature=(Feature)obj;
|
||
73 | // objects.add(obj);
|
||
74 | // return objects.size() - 1;
|
||
75 | // }
|
||
76 | 19399 | vcaballero | |
77 | /* (non-Javadoc)
|
||
78 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#getFeature(int)
|
79 | 19399 | vcaballero | */
|
80 | public Object getObject(int index){ |
||
81 | return objects.get(index);
|
||
82 | } |
||
83 | |||
84 | /* (non-Javadoc)
|
||
85 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#compact(java.util.HashMap)
|
86 | 19399 | vcaballero | */
|
87 | public void compact(HashMap relations) { |
||
88 | |||
89 | } |
||
90 | |||
91 | /* (non-Javadoc)
|
||
92 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#deleteLastFeature()
|
93 | 19399 | vcaballero | */
|
94 | public void deleteLastObject() { |
||
95 | objects.remove(objects.size()-1);
|
||
96 | |||
97 | } |
||
98 | |||
99 | /* (non-Javadoc)
|
||
100 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#open()
|
101 | 19399 | vcaballero | */
|
102 | public void open() { |
||
103 | // TODO Auto-generated method stub
|
||
104 | |||
105 | } |
||
106 | |||
107 | /* (non-Javadoc)
|
||
108 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#close()
|
109 | 19399 | vcaballero | */
|
110 | public void close() { |
||
111 | objects.clear(); |
||
112 | System.gc();
|
||
113 | } |
||
114 | |||
115 | /* (non-Javadoc)
|
||
116 | 24496 | jmvivo | * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#getSize()
|
117 | 19399 | vcaballero | */
|
118 | public int getSize() { |
||
119 | return objects.size();
|
||
120 | } |
||
121 | } |