Mercurial > dive4elements > river
changeset 2122:81312f84689a
Refactored to easier enjoy benefits of caching.
flys-artifacts/trunk@3692 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 17 Jan 2012 08:01:22 +0000 |
parents | 70ef5fdc7414 |
children | 907322e269e3 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java |
diffstat | 5 files changed, 34 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Tue Jan 17 07:55:12 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Jan 17 08:01:22 2012 +0000 @@ -1,3 +1,19 @@ +2012-01-17 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Refactoring. + + * src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java: + Added new constructor. + + * src/main/java/de/intevation/flys/artifacts/model/DataFacet.java: + Refactored, subclass BlackboardDataFacet. + + * src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java: + Refactored, subclass DataFacet. + + * src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java: + Adjusted. + 2012-01-17 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/DataFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java Tue Jan 17 07:55:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/DifferenceCurveFacet.java Tue Jan 17 08:01:22 2012 +0000 @@ -14,6 +14,7 @@ /** * Facet with the curve of a subtraction of two waterlevel-lines. + * TODO inherit directly from DataFacet? Check whether this Facet is obsolete. */ public class DifferenceCurveFacet extends WaterlevelFacet { @@ -44,7 +45,7 @@ WINFOArtifact winfo = (WINFOArtifact)artifact; CalculationResult res = (CalculationResult) - winfo.compute(context, hash, stateID, type, false); + winfo.compute(context, hash, stateId, type, false); WKms [] wkms = (WKms [])res.getData(); @@ -62,7 +63,7 @@ WaterlevelFacet copy = new DifferenceCurveFacet(); copy.set(this); copy.type = type; - copy.stateID = stateID; + copy.stateId = stateId; copy.hash = hash; return copy; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java Tue Jan 17 07:55:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BlackboardDataFacet.java Tue Jan 17 08:01:22 2012 +0000 @@ -22,6 +22,10 @@ super(idx, name, description); } + /** Do not instantiate a BlackboardDataFacet, subclass it instead. */ + public BlackboardDataFacet(String name, String description) { + super(0, name, description); + } /** Define key to which to respond when asked for 'blackboard' * (DataProvider)- data. */
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java Tue Jan 17 07:55:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java Tue Jan 17 08:01:22 2012 +0000 @@ -11,7 +11,7 @@ import de.intevation.flys.artifacts.states.DefaultState.ComputeType; public class DataFacet -extends DefaultFacet +extends BlackboardDataFacet { protected ComputeType type; protected String hash;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java Tue Jan 17 07:55:12 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java Tue Jan 17 08:01:22 2012 +0000 @@ -7,7 +7,7 @@ import de.intevation.artifactdatabase.state.Facet; -import de.intevation.flys.artifacts.WINFOArtifact; +import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; @@ -15,24 +15,14 @@ /** * Facet of a Waterlevel (WQKms). */ -public class WaterlevelFacet extends BlackboardDataFacet { +public class WaterlevelFacet extends DataFacet { private static Logger logger = Logger.getLogger(WaterlevelFacet.class); - protected ComputeType type; - protected String stateID; - protected String hash; - - public WaterlevelFacet(int index, String name, String description) { - this(index, name, description, ComputeType.ADVANCE, null, null); + super(index, name, description, ComputeType.ADVANCE, null, null); } - - public WaterlevelFacet() { - } - - public WaterlevelFacet( int index, String name, @@ -42,10 +32,10 @@ String hash ) { - super(index, name, description); - this.type = type; - this.stateID = stateID; - this.hash = hash; + super(index, name, description, type, stateID, hash); + } + + public WaterlevelFacet() { } @@ -56,10 +46,10 @@ public Object getData(Artifact artifact, CallContext context) { logger.debug("Get data for waterlevels at index: " + index); - WINFOArtifact winfo = (WINFOArtifact)artifact; + FLYSArtifact winfo = (FLYSArtifact)artifact; CalculationResult res = (CalculationResult) - winfo.compute(context, hash, stateID, type, false); + winfo.compute(context, hash, stateId, type, false); WQKms [] wqkms = (WQKms [])res.getData(); @@ -73,7 +63,7 @@ WaterlevelFacet copy = new WaterlevelFacet(); copy.set(this); copy.type = type; - copy.stateID = stateID; + copy.stateId = stateId; copy.hash = hash; return copy; }