Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java @ 7357:9d3e44ab25f2
Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Idea is that Artifact and Access are lightweight. Access access the 'data'
('parameterization') attached to artifact, not the data delivered by means of
artifact and its parameterization.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 16 Oct 2013 10:42:45 +0200 |
parents | 534850c9fabc |
children | 793dfb2f4b7b |
comparison
equal
deleted
inserted
replaced
7356:534850c9fabc | 7357:9d3e44ab25f2 |
---|---|
9 package org.dive4elements.river.artifacts.access; | 9 package org.dive4elements.river.artifacts.access; |
10 | 10 |
11 import java.util.List; | 11 import java.util.List; |
12 | 12 |
13 import org.dive4elements.river.artifacts.D4EArtifact; | 13 import org.dive4elements.river.artifacts.D4EArtifact; |
14 import org.dive4elements.river.artifacts.model.minfo.BedHeight; | |
15 import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory; | |
16 import org.dive4elements.river.artifacts.states.SoundingsSelect; | 14 import org.dive4elements.river.artifacts.states.SoundingsSelect; |
17 import org.dive4elements.river.model.BedHeightSingle; | |
18 import org.dive4elements.river.model.BedHeightSingleValue; | |
19 | 15 |
20 import gnu.trove.TIntArrayList; | 16 import gnu.trove.TIntArrayList; |
21 | 17 |
22 import org.apache.log4j.Logger; | 18 import org.apache.log4j.Logger; |
23 | 19 |
31 private int[] singleIDs; | 27 private int[] singleIDs; |
32 private int[] epochIDs; | 28 private int[] epochIDs; |
33 | 29 |
34 private String yearEpoch; | 30 private String yearEpoch; |
35 | 31 |
32 private String type; | |
33 | |
36 private Integer heightId; | 34 private Integer heightId; |
35 | |
36 private Integer time; | |
37 | 37 |
38 public BedHeightAccess(D4EArtifact artifact) { | 38 public BedHeightAccess(D4EArtifact artifact) { |
39 super(artifact); | 39 super(artifact); |
40 } | 40 } |
41 | 41 |
89 | 89 |
90 return singleIDs; | 90 return singleIDs; |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 public String getYearEpoch() { | 94 public String getType() { |
95 if (yearEpoch == null) { | 95 if (type == null) { |
96 yearEpoch = getString("ye_select"); | 96 type = getString("type"); |
97 } | 97 } |
98 return yearEpoch; | 98 return type; |
99 } | 99 } |
100 | 100 |
101 public String getYearEpoch() { | 101 public String getYearEpoch() { |
102 if (yearEpoch == null) { | 102 if (yearEpoch == null) { |
103 yearEpoch = getString("ye_select"); | 103 yearEpoch = getString("ye_select"); |
136 } | 136 } |
137 | 137 |
138 return epochIDs; | 138 return epochIDs; |
139 } | 139 } |
140 | 140 |
141 /** | 141 public Integer getHeightId() { |
142 * Return the {@link BedHeight} at the height_id and time of the artifact | 142 if (heightId == null) { |
143 * @return {@link BedHeight} | 143 heightId = getInteger("height_id"); |
144 */ | 144 } |
145 public BedHeight getHeight() { | 145 return heightId; |
146 logger.debug("getHeight"); | |
147 return BedHeightFactory.getHeight( | |
148 artifact.getDataAsString("type"), | |
149 Integer.parseInt(artifact.getDataAsString("height_id")), | |
150 Integer.parseInt(artifact.getDataAsString("time"))); | |
151 } | 146 } |
152 | 147 |
153 /** | 148 public Integer getTime() { |
154 * Return a {@link List} of {@link BedHeightSingleValue}s | 149 if (time == null) { |
155 * at the range of the artifact | 150 time = getInteger("time"); |
156 * @return List of {@link BedHeightSingleValue}s | 151 } |
157 */ | 152 return time; |
158 public List<BedHeightSingleValue> getSingleValues() { | |
159 logger.debug("getSingleValues"); | |
160 BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( | |
161 artifact.getDataAsInteger("height_id")); | |
162 return BedHeightSingleValue.getBedHeightSingleValues(single, | |
163 getFrom(), | |
164 getTo()); | |
165 } | 153 } |
166 } | 154 } |
167 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 155 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |