felix@4647: package de.intevation.flys.artifacts.access; felix@4647: felix@4647: import org.apache.log4j.Logger; felix@4647: felix@4647: import de.intevation.artifacts.CallContext; felix@4647: import de.intevation.flys.artifacts.FLYSArtifact; felix@4647: import de.intevation.flys.utils.FLYSUtils; felix@4647: felix@4647: /** For the moment, light-weight wrapper around FLYSUtils. */ felix@4647: // TODO employ 'Caching' like other Accesses, remove usage of FLYSUtils. felix@4647: public class RangeAccess felix@4647: extends RiverAccess felix@4647: { felix@4647: private static Logger logger = Logger.getLogger(RangeAccess.class); felix@4647: felix@4647: private CallContext context; felix@4647: felix@4824: Double from; felix@4824: felix@4824: Double to; felix@4824: felix@4825: Double step; felix@4825: felix@4647: felix@4647: public RangeAccess(FLYSArtifact artifact, CallContext context) { felix@4647: super(artifact); felix@4647: this.context = context; felix@4647: } felix@4647: felix@4647: felix@4827: /** Return ld_from data (in km). */ felix@4824: public double getFrom() { felix@4824: if (from == null) { felix@4824: from = getDouble("ld_from"); felix@4824: } felix@4824: felix@4827: if (logger.isDebugEnabled()) { felix@4827: logger.debug("from: '" + from + "'"); felix@4827: } felix@4827: felix@4824: return from.doubleValue(); felix@4824: } felix@4824: felix@4824: felix@4827: /** Return ld_to data (in km). */ felix@4824: public double getTo() { felix@4824: if (to == null) { felix@4824: to = getDouble("ld_to"); felix@4824: } felix@4827: felix@4827: if (logger.isDebugEnabled()) { felix@4827: logger.debug("to: '" + to + "'"); felix@4827: } felix@4827: felix@4824: return to.doubleValue(); felix@4824: } felix@4824: felix@4824: felix@4825: /** Step width for calculation. */ felix@4825: public Double getStep() { felix@4825: felix@4825: if (step == null) { felix@4825: step = getDouble("ld_step"); felix@4825: } felix@4825: felix@4825: if (logger.isDebugEnabled()) { felix@4825: logger.debug("step: '" + step + "'"); felix@4825: } felix@4825: felix@4825: return step; felix@4825: } felix@4825: felix@4825: felix@4647: /** felix@4647: * Get min and max kilometer, independent of parametization felix@4647: * (ld_from/to vs ld_locations). felix@4647: */ felix@4647: public double[] getKmRange() { felix@4647: return FLYSUtils.getKmRange(this.getArtifact()); felix@4647: } felix@4647: felix@4647: felix@4647: public double[] getKmFromTo() { felix@4647: return FLYSUtils.getKmFromTo(this.getArtifact()); felix@4647: } felix@4647: felix@4647: felix@4647: /** felix@4647: * Return sorted array of locations at which stuff was calculated felix@4647: * (from ld_locations data), null if not parameterized this way. felix@4647: */ felix@4647: public double[] getLocations() { felix@4647: return FLYSUtils.getLocations(this.getArtifact()); felix@4647: } felix@4647: } felix@4647: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :