Revision 25763

View differences:

branches/v2_0_0_prep/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/gt2/GT2Quadtree.java
98 98
 */
99 99
public class GT2Quadtree extends AbstractFeatureIndexProvider implements FeatureIndexProvider {
100 100

  
101
	public static final String NAME = "QuadtreeGt2";
101
	public static final String NAME = GT2Quadtree.class.getSimpleName();
102 102
	/**
103 103
	 * Geotools quadtree implementation
104 104
	 */
......
280 280
	}
281 281

  
282 282
	public void delete(Object value, FeatureReferenceProviderServices fref) {
283
		delete(((org.gvsig.fmap.geom.Geometry) value).getEnvelope(), ((Integer) fref
284
				.getOID()).intValue());
283
		
284
		if (!isCompatibleOID(fref.getOID())) {
285
			throw new IllegalArgumentException("OID not compatible. Must be an instance of Number within the Integer range.");
286
		}
287
				
288
		delete(((org.gvsig.fmap.geom.Geometry) value).getEnvelope(), ((Number) fref.getOID()).intValue());
285 289
	}
286 290

  
287 291
	public void insert(Object value, FeatureReferenceProviderServices fref) {
288
		insert(((org.gvsig.fmap.geom.Geometry) value).getEnvelope(), ((Integer) fref
289
				.getOID()).intValue());
292

  
293
		if (!isCompatibleOID(fref.getOID())) {
294
			throw new IllegalArgumentException("OID not compatible. Must be an instance of Number within the Integer range.");
295
		}
296
		
297
		insert(((org.gvsig.fmap.geom.Geometry) value).getEnvelope(), ((Number) fref.getOID()).intValue());
290 298
	}
291 299

  
292 300
	public List match(Object value) throws FeatureIndexException {
......
336 344
	public List range(Object value1, Object value2) throws FeatureIndexException {
337 345
		throw new UnsupportedOperationException();
338 346
	}
347
	
348
	/**
349
	 * Indicates whether the given OID's type is compatible
350
	 * with this provider
351
	 * 
352
	 * @param oid
353
	 * 
354
	 * @return
355
	 * 		true if this index provider supports the given oid type
356
	 */
357
	private boolean isCompatibleOID(Object oid) {
358
		if (!(oid instanceof Number)) {
359
			return false;
360
		}
361
		
362
		long num = ((Number) oid).longValue();
363
				 
364
		if (num > Integer.MAX_VALUE || num < Integer.MIN_VALUE) {
365
			return false;
366
		}
367
		
368
		return true;
369
	}
339 370

  
340 371
}
branches/v2_0_0_prep/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jts/JTSQuadtree.java
75 75
 */
76 76
public class JTSQuadtree extends AbstractFeatureIndexProvider implements FeatureIndexProvider {
77 77

  
78
	public static final String NAME = "QuadtreeJts";
78
	public static final String NAME = JTSQuadtree.class.getSimpleName();
79 79

  
80 80
	private Quadtree quadtree;
81 81

  
branches/v2_0_0_prep/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jsi/JSIRTree.java
109 109
 */
110 110
public class JSIRTree extends AbstractFeatureIndexProvider implements FeatureIndexProvider {
111 111

  
112
	public static final String NAME = "RTreeJsi";
112
	public static final String NAME = JSIRTree.class.getSimpleName();
113 113

  
114 114
	private RTree rtree;
115 115

  
branches/v2_0_0_prep/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/jsi/JSIPersistentRTree.java
97 97
 */
98 98
public class JSIPersistentRTree extends JSIRTree {
99 99

  
100
	public static final String NAME = "PersistentRTreeJsi";
100
	public static final String NAME = JSIPersistentRTree.class.getSimpleName();
101 101

  
102 102
	/**
103 103
	 * Spatial index in memory
branches/v2_0_0_prep/libraries/libFMap_dalindex/src/org/gvsig/fmap/dal/index/spatial/spatialindex/SPTLIBRTree.java
38 38
public class SPTLIBRTree extends AbstractFeatureIndexProvider implements
39 39
		FeatureIndexProvider {
40 40

  
41
	public static final String NAME = "RTreeSptLib";
41
	public static final String NAME = SPTLIBRTree.class.getSimpleName();
42 42
	/**
43 43
	 * Page size of associated file
44 44
	 */

Also available in: Unified diff