Statistics
| Revision:

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 @ 40435

History | View | Annotate | Download (3.95 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
* 2008 {{Company}}   {{Task}}
26
*/
27

    
28

    
29
package org.gvsig.fmap.dal.feature.spi.index;
30

    
31
import java.util.ArrayList;
32
import java.util.Collection;
33
import java.util.Iterator;
34
import java.util.List;
35
import java.util.ListIterator;
36

    
37
import org.gvsig.fmap.dal.exception.InitializeException;
38

    
39

    
40
public abstract class AbstractFeatureIndexProvider implements FeatureIndexProvider {
41

    
42
        private FeatureIndexProviderServices services = null;
43

    
44
        public void initialize() throws InitializeException {
45
        }
46

    
47
        public void setFeatureIndexProviderServices(
48
                        FeatureIndexProviderServices services) {
49
                this.services = services;
50
        }
51

    
52
        public FeatureIndexProviderServices getFeatureIndexProviderServices() {
53
                return services;
54
        }
55
        
56
        public boolean allowNulls() {
57
                return false;
58
        }
59

    
60
        protected class LongList implements java.util.List{
61
                private ArrayList list;
62
                public LongList(java.util.List list) {
63
                        this.list=(ArrayList)list;
64
                }
65
                public void add(int arg0, Object arg1) {
66
                        list.add(arg0, arg1);
67
                }
68

    
69
                public boolean add(Object arg0) {
70
                        return list.add(arg0);
71
                }
72

    
73
                public Object set(int arg0, Object arg1) {
74
                        return list.set(arg0, arg1);
75
                }
76
                public boolean addAll(Collection arg0) {
77
                        return list.addAll(arg0);
78
                }
79
                public boolean addAll(int arg0, Collection arg1) {
80
                        return list.addAll(arg0, arg1);
81
                }
82
                public void clear() {
83
                        list.clear();
84
                }
85
                public boolean contains(Object o) {
86
                        return list.contains(o);
87
                }
88
                public boolean containsAll(Collection arg0) {
89
                        return list.containsAll(arg0);
90
                }
91
                public Object get(int index) {
92
                        Object obj=list.get(index);
93
                        if (obj instanceof Integer){
94
                                return new Long(((Integer)obj).longValue());
95
                        }
96
                        return obj;
97
                }
98
                public int indexOf(Object o) {
99
                        return list.indexOf(o);
100
                }
101
                public boolean isEmpty() {
102
                        return list.isEmpty();
103
                }
104
                public Iterator iterator() {
105
                        return new LongIterator(list.iterator());
106
                }
107
                public int lastIndexOf(Object o) {
108
                        return list.lastIndexOf(o);
109
                }
110
                public ListIterator listIterator() {
111
                        return list.listIterator();
112
                }
113
                public ListIterator listIterator(int index) {
114
                        return list.listIterator(index);
115
                }
116
                public boolean remove(Object o) {
117
                        return list.remove(o);
118
                }
119
                public Object remove(int index) {
120
                        return list.remove(index);
121
                }
122
                public boolean removeAll(Collection arg0) {
123
                        return list.removeAll(arg0);
124
                }
125
                public boolean retainAll(Collection arg0) {
126
                        return list.retainAll(arg0);
127
                }
128
                public int size() {
129
                        return list.size();
130
                }
131
                public List subList(int fromIndex, int toIndex) {
132
                        return list.subList(fromIndex, toIndex);
133
                }
134
                public Object[] toArray() {
135
                        return list.toArray();
136
                }
137
                public Object[] toArray(Object[] arg0) {
138
                        return list.toArray(arg0);
139
                }
140
                class LongIterator implements Iterator{
141
                        private Iterator iterator;
142
                        public LongIterator(Iterator it) {
143
                                iterator=it;
144
                        }
145
                        public boolean hasNext() {
146
                                return iterator.hasNext();
147
                        }
148

    
149
                        public Object next() {
150
                                Object obj=iterator.next();
151
                                if (obj instanceof Integer){
152
                                        return new Long(((Integer)obj).longValue());
153
                                }
154
                                return obj;
155
                        }
156

    
157
                        public void remove() {
158
                                iterator.remove();
159
                        }
160
                }
161
        }
162
}
163