# HG changeset patch # User Sascha L. Teichmann # Date 1340702977 0 # Node ID 59b14bc676ec38176daf08d978f55c293f085dd3 # Parent 585c0b49e696cd97531a89a6f1dd94082f6eb202 Fitting: Link the functions to there inverses via getInverse(). flys-artifacts/trunk@4793 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Jun 26 09:29:37 2012 +0000 @@ -1,3 +1,18 @@ +2012-06-26 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/math/fitting/FunctionFactory.java: + Register the singletons instead of new objects. + + * src/main/java/de/intevation/flys/artifacts/math/fitting/Pow.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/InvQuad.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/SQPow.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/LogLinear.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/InvPow.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/InvSQPow.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/InvLogLinear.java, + src/main/java/de/intevation/flys/artifacts/math/fitting/Quad.java: + Link the functions to there inverses via getInverse(). + 2012-06-26 Sascha L. Teichmann Implemenation of the inverses of the fitting functions. Needed diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/FunctionFactory.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/FunctionFactory.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/FunctionFactory.java Tue Jun 26 09:29:37 2012 +0000 @@ -13,13 +13,13 @@ private FunctionFactory() { functions = new LinkedHashMap(); - registerFunction(new Log()); - registerFunction(new Linear()); - registerFunction(new LogLinear()); - registerFunction(new Exp()); - registerFunction(new Quad()); - registerFunction(new Pow()); - registerFunction(new SQPow()); + registerFunction(Log.INSTANCE); + registerFunction(Linear.INSTANCE); + registerFunction(LogLinear.INSTANCE); + registerFunction(Exp.INSTANCE); + registerFunction(Quad.INSTANCE); + registerFunction(Pow.INSTANCE); + registerFunction(SQPow.INSTANCE); } public static synchronized FunctionFactory getInstance() { diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvLogLinear.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvLogLinear.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvLogLinear.java Tue Jun 26 09:29:37 2012 +0000 @@ -29,8 +29,7 @@ @Override public Function getInverse() { - // TODO: Implement me! - return null; + return LogLinear.INSTANCE; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvPow.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvPow.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvPow.java Tue Jun 26 09:29:37 2012 +0000 @@ -29,8 +29,7 @@ @Override public Function getInverse() { - // TODO: Implement me! - return null; + return Pow.INSTANCE; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvQuad.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvQuad.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvQuad.java Tue Jun 26 09:29:37 2012 +0000 @@ -29,8 +29,7 @@ @Override public Function getInverse() { - // TODO: Implement me! - return null; + return Quad.INSTANCE; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvSQPow.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvSQPow.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/InvSQPow.java Tue Jun 26 09:29:37 2012 +0000 @@ -29,8 +29,7 @@ @Override public Function getInverse() { - // TODO: Implement me! - return null; + return SQPow.INSTANCE; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/LogLinear.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/LogLinear.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/LogLinear.java Tue Jun 26 09:29:37 2012 +0000 @@ -23,6 +23,8 @@ } }; + public static final Function INSTANCE = new LogLinear(); + public LogLinear() { super( "log-linear", diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Pow.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Pow.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Pow.java Tue Jun 26 09:29:37 2012 +0000 @@ -22,6 +22,8 @@ } }; + public static final Function INSTANCE = new Pow(); + public Pow() { super( "pow", diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Quad.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Quad.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/Quad.java Tue Jun 26 09:29:37 2012 +0000 @@ -22,6 +22,8 @@ } }; + public static final Function INSTANCE = new Quad(); + public Quad() { super( "quad", diff -r 585c0b49e696 -r 59b14bc676ec flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/SQPow.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/SQPow.java Tue Jun 26 06:33:37 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/SQPow.java Tue Jun 26 09:29:37 2012 +0000 @@ -22,6 +22,8 @@ } }; + public static final Function INSTANCE = new SQPow(); + public SQPow() { super( "sq-pow",