Mercurial > dive4elements > river
comparison flys-backend/src/main/java/org/dive4elements/river/importer/XY.java @ 5828:dfb26b03b179
Moved directories to org.dive4elements.river
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 11:53:11 +0200 |
parents | flys-backend/src/main/java/de/intevation/flys/importer/XY.java@2b0426b79a92 |
children | 18619c1e7c2a |
comparison
equal
deleted
inserted
replaced
5827:e308d4ecd35a | 5828:dfb26b03b179 |
---|---|
1 package de.intevation.flys.importer; | |
2 | |
3 | |
4 /** Two doubles and an int index. */ | |
5 public class XY | |
6 implements Comparable<XY> | |
7 { | |
8 public static final double X_EPSILON = 1e-4; | |
9 | |
10 protected double x; | |
11 protected double y; | |
12 protected int index; | |
13 | |
14 public XY() { | |
15 } | |
16 | |
17 public XY(double x, double y, int index) { | |
18 this.x = x; | |
19 this.y = y; | |
20 this.index = index; | |
21 } | |
22 | |
23 @Override | |
24 public int compareTo(XY other) { | |
25 if (x + X_EPSILON < other.x) return -1; | |
26 if (x > other.x + X_EPSILON) return +1; | |
27 if (index < other.index) return -1; | |
28 if (index > other.index) return +1; | |
29 return 0; | |
30 } | |
31 | |
32 public double getX() { | |
33 return x; | |
34 } | |
35 | |
36 public void setX(double x) { | |
37 this.x = x; | |
38 } | |
39 | |
40 public double getY() { | |
41 return y; | |
42 } | |
43 | |
44 public void setY(double y) { | |
45 this.y = y; | |
46 } | |
47 | |
48 public int getIndex() { | |
49 return index; | |
50 } | |
51 | |
52 public void setIndex(int index) { | |
53 this.index = index; | |
54 } | |
55 } | |
56 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |