annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HYKFactory.java @ 2148:345a236f7075

Made HYKFactory.Zone Serializable (and thus cachable). flys-artifacts/trunk@3730 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 20 Jan 2012 08:30:07 +0000
parents 923256599afe
children 8c9c40459d8f
rev   line source
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 import java.util.List;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import java.math.BigDecimal;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
2148
345a236f7075 Made HYKFactory.Zone Serializable (and thus cachable).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2139
diff changeset
8 import java.io.Serializable;
345a236f7075 Made HYKFactory.Zone Serializable (and thus cachable).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2139
diff changeset
9
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import net.sf.ehcache.Cache;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import net.sf.ehcache.Element;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import org.hibernate.Query;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import org.hibernate.Session;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.model.HYKFormation;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.model.HYKFlowZone;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.artifacts.cache.CacheFactory;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.backend.SessionHolder;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 * Factory to access HYKs (hydrographic values).
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 public class HYKFactory
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 private static Logger logger = Logger.getLogger(HYKFactory.class);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 public static String HYK_CACHE_NAME = "hykache";
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 /** Do not instantiate a HYKFactory. */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 private HYKFactory() {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 * Get List of Zones for given river and km.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 */
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
44 public static Object getHYKs(int hykid, double km) {
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 logger.debug("HYKFactory.getHYKs");
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 Cache cache = CacheFactory.getCache(HYK_CACHE_NAME);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 String cacheKey;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 if (cache != null) {
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
52 cacheKey = "" + hykid + "_" + km;
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 Element element = cache.get(cacheKey);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 if (element != null) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 logger.debug("Got hyk from cache");
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 return (List<Zone>)element.getValue();
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 else {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 cacheKey = null;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
63 List<Zone> zones = getZonesUncached(hykid, km);
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 if (zones != null && cacheKey != null) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 logger.debug("Store hykzones in cache.");
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 Element element = new Element(cacheKey, zones);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 cache.put(element);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 return zones;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
75 public static String getHykName(int hykid) {
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
76 logger.debug("HYKFactory.getHykName " + hykid);
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
77
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
78 Session session = SessionHolder.HOLDER.get();
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
79
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
80 // TODO respect interval better. respect multiples (sort, limit),
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
81 // TODO respect flow direction of river.
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
82 Query query = session.createQuery(
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
83 "select description from HYK where id = :hykid ");
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
84 query.setParameter("hykid", hykid);
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
85
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
86 return (String) query.uniqueResult();
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
87 }
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
88
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
89
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 /**
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 *
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 * @param column the position columns value
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 * @param wst_id database id of the wst
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 * @return according WKms.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 */
2137
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
96 // TODO we also need to know the HYK-id to specify which set we are
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
97 // inspecting.
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
98 public static List<Zone> getZonesUncached(int hykid, double km) {
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 if (logger.isDebugEnabled()) {
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
101 logger.debug("HYKFactory.getZoneUncached " + hykid + " km " + km);
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 Session session = SessionHolder.HOLDER.get();
2137
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
105
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
106 // TODO respect interval better. respect multiples (sort, limit),
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
107 // TODO respect flow direction of river.
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 Query query = session.createQuery(
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
109 "from HYKFormation where entry.HYK.id = :hykid " +
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
110 " and :km between entry.km - cast(distance_vl/1000.0 + 0.001 as big_decimal) and " +
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
111 " entry.km + cast(distance_vl/1000.0 + 0.001 as big_decimal)" +
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
112 " order by entry.km asc");
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
113 query.setParameter("hykid", hykid);
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 query.setParameter("km", new BigDecimal(km));
2148
345a236f7075 Made HYKFactory.Zone Serializable (and thus cachable).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2139
diff changeset
115
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 List<HYKFormation> forms = query.list();
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 List<Zone> zones = new ArrayList<Zone>();
2139
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
119 // TODO limit query by one; sensible sorting.
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
120 // Take the first one.
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
121 if (forms.size() >= 1) {
923256599afe Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2137
diff changeset
122 HYKFormation form = forms.get(0);
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 // Create respective zones.
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 for (HYKFlowZone flowZone: form.getZones()) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 Zone z = new Zone(flowZone.getA().doubleValue(),
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 flowZone.getB().doubleValue(),
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 flowZone.getType().getName());
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 zones.add(z);
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 return zones;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 /** Labelled section. */
2148
345a236f7075 Made HYKFactory.Zone Serializable (and thus cachable).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2139
diff changeset
136 public static class Zone implements Serializable {
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 /** Lower end of segment. */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 protected double from;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 /** Upper end of segment. */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 protected double to;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 /** The label. */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 protected String name;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 /** Constructor for labelled section. */
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 public Zone (double from, double to, String name) {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 this.from = from;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 this.to = to;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 this.name = name;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150
2137
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
151 /** Get upper value. */
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
152 public double getTo() {
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
153 return to;
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
154 }
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
155
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
156 /** Get lower value. */
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 public double getFrom() {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 return from;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160
2137
04b6b6a4564d Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2131
diff changeset
161 /** Get name (type). */
2131
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 public String getName() {
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 return name;
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 } // public static class Zone
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 }
e50a928187cd Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org