annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/UnivariateRealFunctionFunction.java @ 4357:11cf29eb002c

FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 02 Nov 2012 11:58:11 +0100
parents 893b2477208f
children
rev   line source
3733
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.math;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import org.apache.commons.math.FunctionEvaluationException;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import org.apache.commons.math.analysis.UnivariateRealFunction;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 public final class UnivariateRealFunctionFunction
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 implements Function
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 private UnivariateRealFunction function;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 public UnivariateRealFunctionFunction(UnivariateRealFunction function) {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 this.function = function;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 @Override
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 public double value(double x) {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 try {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 return function.value(x);
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 catch (FunctionEvaluationException fee) {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 return Double.NaN;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 public UnivariateRealFunction getFunction() {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 return function;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 public void setFunction(UnivariateRealFunction function) {
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 this.function = function;
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 }
893b2477208f Some first models needed for the extreme waterlevels.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org