Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java @ 8646:8e5c026216fd
(issue1754) Extend RangeAccess to simplyfiy range access where it is assumed that from < to
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 30 Mar 2015 19:27:11 +0200 |
parents | c62837ba37f3 |
children | 30b1ddadf275 |
comparison
equal
deleted
inserted
replaced
8645:5c4766ac20ba | 8646:8e5c026216fd |
---|---|
123 | 123 |
124 public boolean hasTo() { | 124 public boolean hasTo() { |
125 return to != null || (to = getDouble("ld_to")) != null; | 125 return to != null || (to = getDouble("ld_to")) != null; |
126 } | 126 } |
127 | 127 |
128 /* If left_to_right is set to true this returns | |
129 * the smaller value of from and to. */ | |
130 public double getFrom(boolean left_to_right) { | |
131 if (!left_to_right) { | |
132 return getFrom(); | |
133 } | |
134 double from = getFrom(); | |
135 double to = getTo(); | |
136 return from > to ? to : from; | |
137 } | |
128 | 138 |
129 /** Return ld_from data (in km). If not found, the min. */ | 139 /** Return ld_from data (in km). If not found, the min. */ |
130 public double getFrom() { | 140 public double getFrom() { |
131 if (from == null) { | 141 if (from == null) { |
132 from = getDouble("ld_from"); | 142 from = getDouble("ld_from"); |
142 } | 152 } |
143 | 153 |
144 return from.doubleValue(); | 154 return from.doubleValue(); |
145 } | 155 } |
146 | 156 |
157 /* If left_to_right is set to true this returns | |
158 * the larger value of from and to. */ | |
159 public double getTo(boolean left_to_right) { | |
160 if (!left_to_right) { | |
161 return getTo(); | |
162 } | |
163 double from = getFrom(); | |
164 double to = getTo(); | |
165 return from > to ? from : to; | |
166 } | |
147 | 167 |
148 /** Return ld_to data (in km), if not found, the max. */ | 168 /** Return ld_to data (in km), if not found, the max. */ |
149 public double getTo() { | 169 public double getTo() { |
150 if (to == null) { | 170 if (to == null) { |
151 to = getDouble("ld_to"); | 171 to = getDouble("ld_to"); |