Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java @ 9155:9b4f5e61c02e
Changed to list of DateRange, added methods in DateRange to support year ranges
author | mschaefer |
---|---|
date | Tue, 19 Jun 2018 14:15:32 +0200 |
parents | 766890addcb2 |
children |
comparison
equal
deleted
inserted
replaced
9154:cd24db77f044 | 9155:9b4f5e61c02e |
---|---|
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 | 10 |
11 package org.dive4elements.river.artifacts.sinfo.collision; | 11 package org.dive4elements.river.artifacts.sinfo.collision; |
12 | 12 |
13 import java.util.Arrays; | |
14 import java.util.List; | |
15 | |
13 import org.dive4elements.river.artifacts.access.RangeAccess; | 16 import org.dive4elements.river.artifacts.access.RangeAccess; |
14 import org.dive4elements.river.artifacts.common.EpochYearAccessHelper; | 17 import org.dive4elements.river.artifacts.common.EpochYearAccessHelper; |
18 import org.dive4elements.river.artifacts.model.DateRange; | |
15 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | 19 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; |
16 import org.dive4elements.river.artifacts.sinfo.SinfoCalcMode; | 20 import org.dive4elements.river.artifacts.sinfo.SinfoCalcMode; |
17 | 21 |
18 /** | 22 /** |
19 * Access to the flow depth calculation type specific SInfo artifact data. | 23 * Access to the flow depth calculation type specific SInfo artifact data. |
46 | 50 |
47 public int[] getYears() { | 51 public int[] getYears() { |
48 return this.helper.getYears("state.sinfo.year", "years"); | 52 return this.helper.getYears("state.sinfo.year", "years"); |
49 } | 53 } |
50 | 54 |
51 public int[][] getEpochs() { | 55 public List<DateRange> getEpochs() { |
52 return this.helper.getEpochs("state.sinfo.epoch", "epochs"); | 56 return this.helper.getEpochs("state.sinfo.epoch", "epochs"); |
53 } | 57 } |
54 | 58 |
59 /** | |
60 * String expression of the years or epoches collection, resp. | |
61 */ | |
62 public String getYearsHeader() { | |
63 if (getYears() != null) { | |
64 final String ys = Arrays.toString(getYears()); | |
65 return ys.substring(1, ys.length() - 1); | |
66 } | |
67 else { | |
68 String ys = ""; | |
69 String sep = ""; | |
70 for (final DateRange dr : getEpochs()) { | |
71 ys += String.format("%s%d-%d", sep, dr.getFromYear(), dr.getToYear()); | |
72 sep = ", "; | |
73 } | |
74 return ys; | |
75 } | |
76 } | |
55 } | 77 } |