svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.spi / src / main / java / org / gvsig / fmap / dal / feature / spi / index / AbstractFeatureIndexProvider.java @ 40559
History | View | Annotate | Download (4.89 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 |
/* gvSIG. Geographic Information System of the Valencian Government
|
25 |
*
|
26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
27 |
* of the Valencian Government (CIT)
|
28 |
*
|
29 |
* This program is free software; you can redistribute it and/or
|
30 |
* modify it under the terms of the GNU General Public License
|
31 |
* as published by the Free Software Foundation; either version 2
|
32 |
* of the License, or (at your option) any later version.
|
33 |
*
|
34 |
* This program is distributed in the hope that it will be useful,
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
37 |
* GNU General Public License for more details.
|
38 |
*
|
39 |
* You should have received a copy of the GNU General Public License
|
40 |
* along with this program; if not, write to the Free Software
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
42 |
* MA 02110-1301, USA.
|
43 |
*
|
44 |
*/
|
45 |
|
46 |
/*
|
47 |
* AUTHORS (In addition to CIT):
|
48 |
* 2008 {{Company}} {{Task}}
|
49 |
*/
|
50 |
|
51 |
|
52 |
package org.gvsig.fmap.dal.feature.spi.index; |
53 |
|
54 |
import java.util.ArrayList; |
55 |
import java.util.Collection; |
56 |
import java.util.Iterator; |
57 |
import java.util.List; |
58 |
import java.util.ListIterator; |
59 |
|
60 |
import org.gvsig.fmap.dal.exception.InitializeException; |
61 |
|
62 |
|
63 |
public abstract class AbstractFeatureIndexProvider implements FeatureIndexProvider { |
64 |
|
65 |
private FeatureIndexProviderServices services = null; |
66 |
|
67 |
public void initialize() throws InitializeException { |
68 |
} |
69 |
|
70 |
public void setFeatureIndexProviderServices( |
71 |
FeatureIndexProviderServices services) { |
72 |
this.services = services;
|
73 |
} |
74 |
|
75 |
public FeatureIndexProviderServices getFeatureIndexProviderServices() {
|
76 |
return services;
|
77 |
} |
78 |
|
79 |
public boolean allowNulls() { |
80 |
return false; |
81 |
} |
82 |
|
83 |
protected class LongList implements java.util.List{ |
84 |
private ArrayList list; |
85 |
public LongList(java.util.List list) {
|
86 |
this.list=(ArrayList)list; |
87 |
} |
88 |
public void add(int arg0, Object arg1) { |
89 |
list.add(arg0, arg1); |
90 |
} |
91 |
|
92 |
public boolean add(Object arg0) { |
93 |
return list.add(arg0);
|
94 |
} |
95 |
|
96 |
public Object set(int arg0, Object arg1) { |
97 |
return list.set(arg0, arg1);
|
98 |
} |
99 |
public boolean addAll(Collection arg0) { |
100 |
return list.addAll(arg0);
|
101 |
} |
102 |
public boolean addAll(int arg0, Collection arg1) { |
103 |
return list.addAll(arg0, arg1);
|
104 |
} |
105 |
public void clear() { |
106 |
list.clear(); |
107 |
} |
108 |
public boolean contains(Object o) { |
109 |
return list.contains(o);
|
110 |
} |
111 |
public boolean containsAll(Collection arg0) { |
112 |
return list.containsAll(arg0);
|
113 |
} |
114 |
public Object get(int index) { |
115 |
Object obj=list.get(index);
|
116 |
if (obj instanceof Integer){ |
117 |
return new Long(((Integer)obj).longValue()); |
118 |
} |
119 |
return obj;
|
120 |
} |
121 |
public int indexOf(Object o) { |
122 |
return list.indexOf(o);
|
123 |
} |
124 |
public boolean isEmpty() { |
125 |
return list.isEmpty();
|
126 |
} |
127 |
public Iterator iterator() { |
128 |
return new LongIterator(list.iterator()); |
129 |
} |
130 |
public int lastIndexOf(Object o) { |
131 |
return list.lastIndexOf(o);
|
132 |
} |
133 |
public ListIterator listIterator() { |
134 |
return list.listIterator();
|
135 |
} |
136 |
public ListIterator listIterator(int index) { |
137 |
return list.listIterator(index);
|
138 |
} |
139 |
public boolean remove(Object o) { |
140 |
return list.remove(o);
|
141 |
} |
142 |
public Object remove(int index) { |
143 |
return list.remove(index);
|
144 |
} |
145 |
public boolean removeAll(Collection arg0) { |
146 |
return list.removeAll(arg0);
|
147 |
} |
148 |
public boolean retainAll(Collection arg0) { |
149 |
return list.retainAll(arg0);
|
150 |
} |
151 |
public int size() { |
152 |
return list.size();
|
153 |
} |
154 |
public List subList(int fromIndex, int toIndex) { |
155 |
return list.subList(fromIndex, toIndex);
|
156 |
} |
157 |
public Object[] toArray() { |
158 |
return list.toArray();
|
159 |
} |
160 |
public Object[] toArray(Object[] arg0) { |
161 |
return list.toArray(arg0);
|
162 |
} |
163 |
class LongIterator implements Iterator{ |
164 |
private Iterator iterator; |
165 |
public LongIterator(Iterator it) { |
166 |
iterator=it; |
167 |
} |
168 |
public boolean hasNext() { |
169 |
return iterator.hasNext();
|
170 |
} |
171 |
|
172 |
public Object next() { |
173 |
Object obj=iterator.next();
|
174 |
if (obj instanceof Integer){ |
175 |
return new Long(((Integer)obj).longValue()); |
176 |
} |
177 |
return obj;
|
178 |
} |
179 |
|
180 |
public void remove() { |
181 |
iterator.remove(); |
182 |
} |
183 |
} |
184 |
} |
185 |
} |
186 |
|