Revision 19447
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/order/FeatureComparator.java | ||
---|---|---|
1 |
package org.gvsig.data.vectorial.order; |
|
2 |
|
|
3 |
import java.util.Comparator; |
|
4 |
|
|
5 |
import org.gvsig.data.vectorial.IFeature; |
|
6 |
import org.gvsig.data.vectorial.IFeatureID; |
|
7 |
import org.gvsig.data.vectorial.IFeatureType; |
|
8 |
|
|
9 |
public class FeatureComparator implements Comparator { |
|
10 |
protected String expresionString; |
|
11 |
protected IFeatureType featureType; |
|
12 |
|
|
13 |
public FeatureComparator(IFeatureType featureType,String expresion){ |
|
14 |
this.featureType=featureType; |
|
15 |
this.expresionString=expresion; |
|
16 |
} |
|
17 |
|
|
18 |
private IFeature toFeature(Object arg){ |
|
19 |
if (arg instanceof IFeatureID){ |
|
20 |
return ((IFeatureID)arg).getFeature(featureType); |
|
21 |
} else { |
|
22 |
return (IFeature)arg; |
|
23 |
} |
|
24 |
} |
|
25 |
|
|
26 |
public int compare(Object arg0, Object arg1) { |
|
27 |
IFeature feature0, feature1; |
|
28 |
feature0 = toFeature(arg0); |
|
29 |
feature1 = toFeature(arg1); |
|
30 |
|
|
31 |
// TODO Auto-generated method stub |
|
32 |
return 0; |
|
33 |
} |
|
34 |
|
|
35 |
|
|
36 |
} |
|
0 | 37 |
Also available in: Unified diff