Revision 28782 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureDataComparator.java
FeatureDataComparator.java | ||
---|---|---|
59 | 59 |
FeatureQueryOrderMember order; |
60 | 60 |
Comparable v1; |
61 | 61 |
Comparable v2; |
62 |
Object o1; |
|
63 |
Object o2; |
|
62 | 64 |
int v; |
63 | 65 |
int fieldIndex; |
64 | 66 |
|
... | ... | |
77 | 79 |
if (element.order.hasEvaluator()) { |
78 | 80 |
Evaluator evaluator = element.order.getEvaluator(); |
79 | 81 |
try { |
80 |
v1 = (Comparable) evaluator.evaluate(f1);
|
|
81 |
v2 = (Comparable) evaluator.evaluate(f2);
|
|
82 |
o1 = evaluator.evaluate(f1);
|
|
83 |
o2 = evaluator.evaluate(f2);
|
|
82 | 84 |
} catch (EvaluatorException e) { |
83 | 85 |
throw new DataEvaluatorRuntimeException(e); |
84 | 86 |
} |
85 | 87 |
} else { |
86 |
v1 = (Comparable) f1.get(element.fieldIndex);
|
|
87 |
v2 = (Comparable) f2.get(element.fieldIndex);
|
|
88 |
o1 = f1.get(element.fieldIndex);
|
|
89 |
o2 = f2.get(element.fieldIndex);
|
|
88 | 90 |
} |
89 |
if (v1 == null) {
|
|
90 |
if (v2 == null) {
|
|
91 |
if (o1 == null) {
|
|
92 |
if (o2 == null) {
|
|
91 | 93 |
return 0; |
92 | 94 |
} else { |
93 | 95 |
v = 1; |
94 | 96 |
} |
95 | 97 |
} else { |
96 |
v = v1.compareTo(v2); |
|
98 |
if (o1 instanceof Comparable && o2 instanceof Comparable) { |
|
99 |
v1 = (Comparable) o1; |
|
100 |
v2 = (Comparable) o2; |
|
101 |
v = v1.compareTo(v2); |
|
102 |
} else { |
|
103 |
v = -1; |
|
104 |
} |
|
97 | 105 |
} |
106 |
|
|
98 | 107 |
if (v != 0) { |
99 | 108 |
if (element.order.getAscending()) { |
100 | 109 |
return v; |
Also available in: Unified diff