Statistics
| Revision:

root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.algorithm / src / main / java / es / unex / sextante / morphometry / fillElevationValues / FeatureAndDistance.java @ 59

History | View | Annotate | Download (1.02 KB)

1
package es.unex.sextante.morphometry.fillElevationValues;
2

    
3
import es.unex.sextante.dataObjects.IFeature;
4

    
5
public class FeatureAndDistance
6
         implements
7
            Comparable {
8

    
9
   private final IFeature feature;
10
   private final double   dDist;
11

    
12

    
13
   public FeatureAndDistance(final IFeature feature,
14
                             final double dDist) {
15

    
16
      this.feature = feature;
17
      this.dDist = dDist;
18

    
19
   }
20

    
21

    
22
   public double getDist() {
23

    
24
      return dDist;
25

    
26
   }
27

    
28

    
29
   public IFeature getFeature() {
30

    
31
      return feature;
32

    
33
   }
34

    
35

    
36
   public int compareTo(final Object ob) throws ClassCastException {
37

    
38
      if (!(ob instanceof FeatureAndDistance)) {
39
         throw new ClassCastException();
40
      }
41

    
42
      final double dValue = ((FeatureAndDistance) ob).getDist();
43
      final double dDif = this.dDist - dValue;
44

    
45
      if (dDif > 0.0) {
46
         return 1;
47
      }
48
      else if (dDif < 0.0) {
49
         return -1;
50
      }
51
      else {
52
         return 0;
53
      }
54

    
55
   }
56

    
57
}