Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java@bd047b71ab37 |
children | 4897a58c8746 |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.artifacts.access; | |
2 | |
3 import java.util.Arrays; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import org.dive4elements.artifacts.CallContext; | |
8 import org.dive4elements.river.artifacts.FLYSArtifact; | |
9 import org.dive4elements.river.utils.FLYSUtils; | |
10 import org.dive4elements.river.utils.StringUtil; | |
11 | |
12 | |
13 public class BedDifferencesAccess | |
14 extends RiverAccess | |
15 { | |
16 private static Logger logger = Logger.getLogger(BedDifferencesAccess.class); | |
17 private String yearEpoch; | |
18 private String[] diffs; | |
19 | |
20 private CallContext context; | |
21 | |
22 public BedDifferencesAccess(FLYSArtifact artifact, CallContext context) { | |
23 super(artifact); | |
24 this.context = context; | |
25 } | |
26 | |
27 public String getYearEpoch() { | |
28 yearEpoch = getString("ye_select"); | |
29 return yearEpoch; | |
30 } | |
31 | |
32 public FLYSArtifact[][] getDifferenceArtifacts() { | |
33 diffs = getString("diffids").split("#"); | |
34 logger.debug("diffs: " + Arrays.toString(diffs)); | |
35 FLYSArtifact[][] artifacts = new FLYSArtifact[diffs.length/2][2]; | |
36 for (int i = 0; i < diffs.length; i += 2) { | |
37 String diff1 = StringUtil.unbracket(diffs[0 + 2*i]); | |
38 String diff2 = StringUtil.unbracket(diffs[1 + 2*i]); | |
39 String[] diff1parts = diff1.split(";"); | |
40 String[] diff2parts = diff2.split(";"); | |
41 logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]); | |
42 artifacts[i][0] = FLYSUtils.getArtifact(diff1parts[0], context); | |
43 artifacts[i][1] = FLYSUtils.getArtifact(diff2parts[0], context); | |
44 } | |
45 return artifacts; | |
46 } | |
47 | |
48 public static int getHeightId(FLYSArtifact artifact) { | |
49 Access a = new Access(artifact); | |
50 return a.getInteger("height_id"); | |
51 } | |
52 } | |
53 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |