root / branches / v2_0_0_prep / libraries / org.gvsig.fmap.dal.cache / src / main / java / org / gvsig / fmap / dal / cache / CacheFeatureSet.java @ 32646
History | View | Annotate | Download (4.2 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 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 {Iver T.I.} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.fmap.dal.cache; |
29 |
|
30 |
import java.util.List; |
31 |
|
32 |
import org.gvsig.fmap.dal.DataStore; |
33 |
import org.gvsig.fmap.dal.exception.DataException; |
34 |
import org.gvsig.fmap.dal.feature.DisposableIterator; |
35 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
36 |
import org.gvsig.fmap.dal.feature.Feature; |
37 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
39 |
import org.gvsig.fmap.dal.feature.FeatureType; |
40 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeature; |
41 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
42 |
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider; |
43 |
import org.gvsig.tools.exception.BaseException; |
44 |
import org.gvsig.tools.visitor.Visitor; |
45 |
|
46 |
/**
|
47 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
48 |
*/
|
49 |
public class CacheFeatureSet implements FeatureSet{ |
50 |
private FeatureSetProvider featureSetProvider = null; |
51 |
private FeatureStore store = null; |
52 |
|
53 |
public CacheFeatureSet(FeatureStore store, FeatureSetProvider featureSetProvider) {
|
54 |
this.featureSetProvider = featureSetProvider;
|
55 |
this.store = store;
|
56 |
} |
57 |
|
58 |
public void delete(Feature feature) throws DataException { |
59 |
// TODO Auto-generated method stub
|
60 |
|
61 |
} |
62 |
|
63 |
public DisposableIterator fastIterator() throws DataException { |
64 |
return new CacheFeatureSetIterator(featureSetProvider.fastIterator()); |
65 |
} |
66 |
|
67 |
public DisposableIterator fastIterator(long index) throws DataException { |
68 |
return new CacheFeatureSetIterator(featureSetProvider.fastIterator(index)); |
69 |
} |
70 |
|
71 |
public FeatureType getDefaultFeatureType() {
|
72 |
// TODO Auto-generated method stub
|
73 |
return null; |
74 |
} |
75 |
|
76 |
public List getFeatureTypes() { |
77 |
// TODO Auto-generated method stub
|
78 |
return null; |
79 |
} |
80 |
|
81 |
public long getSize() throws DataException { |
82 |
// TODO Auto-generated method stub
|
83 |
return 0; |
84 |
} |
85 |
|
86 |
public void insert(EditableFeature feature) throws DataException { |
87 |
// TODO Auto-generated method stub
|
88 |
|
89 |
} |
90 |
|
91 |
public boolean isEmpty() throws DataException { |
92 |
// TODO Auto-generated method stub
|
93 |
return false; |
94 |
} |
95 |
|
96 |
public DisposableIterator iterator(long index) throws DataException { |
97 |
return new CacheFeatureSetIterator(featureSetProvider.iterator(index)); |
98 |
} |
99 |
|
100 |
public DisposableIterator iterator() throws DataException { |
101 |
return new CacheFeatureSetIterator(featureSetProvider.iterator()); |
102 |
} |
103 |
|
104 |
public void update(EditableFeature feature) throws DataException { |
105 |
// TODO Auto-generated method stub
|
106 |
|
107 |
} |
108 |
|
109 |
public void dispose() { |
110 |
// TODO Auto-generated method stub
|
111 |
|
112 |
} |
113 |
|
114 |
public boolean isFromStore(DataStore store) { |
115 |
// TODO Auto-generated method stub
|
116 |
return false; |
117 |
} |
118 |
|
119 |
public void accept(Visitor visitor) throws BaseException { |
120 |
// TODO Auto-generated method stub
|
121 |
|
122 |
} |
123 |
|
124 |
public void accept(Visitor visitor, long firstValueIndex) |
125 |
throws BaseException {
|
126 |
// TODO Auto-generated method stub
|
127 |
|
128 |
} |
129 |
|
130 |
protected class CacheFeatureSetIterator implements DisposableIterator { |
131 |
protected DisposableIterator iterator;
|
132 |
|
133 |
public CacheFeatureSetIterator(DisposableIterator iterator) throws DataException { |
134 |
this.iterator = iterator;
|
135 |
} |
136 |
|
137 |
public void dispose() { |
138 |
// TODO Auto-generated method stub
|
139 |
|
140 |
} |
141 |
|
142 |
public boolean hasNext() { |
143 |
return iterator.hasNext();
|
144 |
} |
145 |
|
146 |
public Object next() { |
147 |
return new DefaultFeature(store, (FeatureProvider)iterator.next()); |
148 |
} |
149 |
|
150 |
public void remove() { |
151 |
// TODO Auto-generated method stub
|
152 |
} |
153 |
|
154 |
} |
155 |
|
156 |
} |
157 |
|