Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/sq/StaticSQRelationFacet.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-artifacts/src/main/java/org/dive4elements/river/artifacts/states/sq/StaticSQRelationFacet.java@bd047b71ab37 |
children | 4897a58c8746 |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.artifacts.states.sq; | |
2 | |
3 import org.dive4elements.artifactdatabase.state.DefaultFacet; | |
4 import org.dive4elements.artifactdatabase.state.Facet; | |
5 import org.dive4elements.artifacts.Artifact; | |
6 import org.dive4elements.artifacts.CallContext; | |
7 import org.dive4elements.river.artifacts.math.fitting.Function; | |
8 import org.dive4elements.river.artifacts.math.fitting.FunctionFactory; | |
9 import org.dive4elements.river.artifacts.model.sq.SQFunction; | |
10 import org.dive4elements.river.artifacts.model.sq.StaticSQRelation; | |
11 | |
12 | |
13 public class StaticSQRelationFacet | |
14 extends DefaultFacet | |
15 implements Facet | |
16 { | |
17 public static final String FUNCTION = "sq-pow"; | |
18 | |
19 private StaticSQRelation relation; | |
20 | |
21 | |
22 public StaticSQRelationFacet( | |
23 int ndx, | |
24 String name, | |
25 String description, | |
26 StaticSQRelation relation) { | |
27 super(ndx, name, description); | |
28 this.relation = relation; | |
29 } | |
30 | |
31 @Override | |
32 public Object getData(Artifact artifact, CallContext context) { | |
33 double qmax = relation.getQmax(); | |
34 double[] coeffs = new double[] {relation.getA(), relation.getB()}; | |
35 Function func = FunctionFactory.getInstance().getFunction(FUNCTION); | |
36 org.dive4elements.river.artifacts.math.Function function = | |
37 func.instantiate(coeffs); | |
38 SQFunction sqf = new SQFunction(function, 0, qmax); | |
39 return sqf; | |
40 } | |
41 | |
42 @Override | |
43 public Facet deepCopy() { | |
44 StaticSQRelationFacet copy = | |
45 new StaticSQRelationFacet(index, name, description, relation); | |
46 copy.set(this); | |
47 return copy; | |
48 } | |
49 } |