comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java @ 186:cf8cbcb6a10d

Added parser to read *.KM files. flys-backend/trunk@1506 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 17 Mar 2011 17:43:57 +0000
parents a60edcfe5f53
children 003ac16812dd
comparison
equal deleted inserted replaced
185:a60edcfe5f53 186:cf8cbcb6a10d
1 package de.intevation.flys.importer; 1 package de.intevation.flys.importer;
2 2
3 public class ImportRange 3 public class ImportRange
4 implements Comparable<ImportRange>
4 { 5 {
5 public Double from; 6 public Double from;
6 public Double to; 7 public Double to;
7 8
8 public ImportRange() { 9 public ImportRange() {
9 } 10 }
10 11
11 public ImportRange(Double from, Double to) { 12 public ImportRange(Double from, Double to) {
13 this.from = from;
14 this.to = to;
15 }
16
17 private static final int compare(Double a, Double b) {
18 if (a == null && b == null) {
19 return 0;
20 }
21 if (a == null && b != null) {
22 return -1;
23 }
24 if (a != null && b == null) {
25 return +1;
26 }
27 return a.compareTo(b);
28 }
29
30 public int compareTo(ImportRange other) {
31 int cmp = compare(from, other.from);
32 if (cmp != 0) return cmp;
33 return compare(to, other.to);
12 } 34 }
13 35
14 public Double getFrom() { 36 public Double getFrom() {
15 return from; 37 return from;
16 } 38 }

http://dive4elements.wald.intevation.org