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

History | View | Annotate | Download (3.95 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

    
25
package org.gvsig.fmap.dal.feature.spi.index;
26

    
27
import java.util.ArrayList;
28
import java.util.Collection;
29
import java.util.Iterator;
30
import java.util.List;
31
import java.util.ListIterator;
32

    
33
import org.gvsig.fmap.dal.exception.InitializeException;
34

    
35

    
36
public abstract class AbstractFeatureIndexProvider implements FeatureIndexProvider {
37

    
38
        private FeatureIndexProviderServices services = null;
39

    
40
        public void initialize() throws InitializeException {
41
        }
42

    
43
        public void setFeatureIndexProviderServices(
44
                        FeatureIndexProviderServices services) {
45
                this.services = services;
46
        }
47

    
48
        public FeatureIndexProviderServices getFeatureIndexProviderServices() {
49
                return services;
50
        }
51
        
52
        public boolean allowNulls() {
53
                return false;
54
        }
55

    
56
        protected class LongList implements java.util.List{
57
                private ArrayList list;
58
                public LongList(java.util.List list) {
59
                        this.list=(ArrayList)list;
60
                }
61
                public void add(int arg0, Object arg1) {
62
                        list.add(arg0, arg1);
63
                }
64

    
65
                public boolean add(Object arg0) {
66
                        return list.add(arg0);
67
                }
68

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

    
145
                        public Object next() {
146
                                Object obj=iterator.next();
147
                                if (obj instanceof Integer){
148
                                        return new Long(((Integer)obj).longValue());
149
                                }
150
                                return obj;
151
                        }
152

    
153
                        public void remove() {
154
                                iterator.remove();
155
                        }
156
                }
157
        }
158
}
159