# HG changeset patch # User Sascha L. Teichmann # Date 1300378359 0 # Node ID a60edcfe5f5314a9786259b5c5727c2a8c13a5e1 # Parent 4ab2c3bd474caacc750b8f3fb48ea05eac9a87fc Added new helper models for import. flys-backend/trunk@1503 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Thu Mar 17 15:21:50 2011 +0000 +++ b/flys-backend/ChangeLog Thu Mar 17 16:12:39 2011 +0000 @@ -1,3 +1,15 @@ +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportPosition.java, + src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/ImportAttribute.java, + src/main/java/de/intevation/flys/importer/ImportAnnotation.java: + New helper models for import. + + * src/main/java/de/intevation/flys/importer/PegelGltParser.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java: + Use new models. + 2011-03-17 Sascha L. Teichmann * src/main/java/de/intevation/flys/importer/PegelGltParser.java: diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/src/main/java/de/intevation/flys/importer/ImportAnnotation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportAnnotation.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,36 @@ +package de.intevation.flys.importer; + +public class ImportAnnotation +{ + protected ImportAttribute attribute; + protected ImportPosition position; + protected ImportRange range; + + public ImportAnnotation() { + } + + public ImportAttribute getAttribute() { + return attribute; + } + + public void setAttribute(ImportAttribute attribute) { + this.attribute = attribute; + } + + public ImportPosition getPosition() { + return position; + } + + public void setPosition(ImportPosition position) { + this.position = position; + } + + public ImportRange getRange() { + return range; + } + + public void setRange(ImportRange range) { + this.range = range; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/src/main/java/de/intevation/flys/importer/ImportAttribute.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportAttribute.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,30 @@ +package de.intevation.flys.importer; + +public class ImportAttribute +{ + protected String value; + + public ImportAttribute() { + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof ImportPosition)) return false; + return value.equals(((ImportPosition)other).value); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java Thu Mar 17 15:21:50 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java Thu Mar 17 16:12:39 2011 +0000 @@ -4,8 +4,7 @@ public class ImportGauge { - protected double from; - protected double to; + protected ImportRange range; protected File staFile; protected File atFile; @@ -13,27 +12,14 @@ public ImportGauge() { } - public ImportGauge(double from, double to, File staFile, File atFile) { - this.from = from; - this.to = to; + public ImportGauge(ImportRange range, File staFile, File atFile) { + this.range = range; this.staFile = staFile; this.atFile = atFile; } - public void setFrom(double from) { - this.from = from; - } - - public double getFrom() { - return from; - } - - public void setTo(double to) { - this.to = to; - } - - public double getTo() { - return to; + public void setRange(ImportRange range) { + this.range = range; } public void setStaFile(File staFile) { diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/src/main/java/de/intevation/flys/importer/ImportPosition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportPosition.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,35 @@ +package de.intevation.flys.importer; + +public class ImportPosition +{ + protected String value; + + public ImportPosition() { + } + + public ImportPosition(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof ImportPosition)) return false; + return value.equals(((ImportPosition)other).value); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : + diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,30 @@ +package de.intevation.flys.importer; + +public class ImportRange +{ + public Double from; + public Double to; + + public ImportRange() { + } + + public ImportRange(Double from, Double to) { + } + + public Double getFrom() { + return from; + } + + public void setFrom(Double from) { + this.from = from; + } + + public Double getTo() { + return to; + } + + public void setTo(Double to) { + this.to = to; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 4ab2c3bd474c -r a60edcfe5f53 flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.java Thu Mar 17 15:21:50 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.java Thu Mar 17 16:12:39 2011 +0000 @@ -74,6 +74,7 @@ double from = Double.parseDouble(parts[0].replace(",", ".")); double to = Double.parseDouble(parts[1].replace(",", ".")); if (to < from) { double t = from; from = to; to = t; } + ImportRange range = new ImportRange(from, to); File staFile = FileTools.repair(new File(parent, parts[2])); File atFile = FileTools.repair(new File(parent, parts[3])); @@ -84,7 +85,7 @@ log.debug("\tat: " + atFile); } - gauges.add(new ImportGauge(from, to, staFile, atFile)); + gauges.add(new ImportGauge(range, staFile, atFile)); } } finally {