From 5220875108dea18233023bf518c8fd1011c5c1e2 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sat, 23 May 2009 11:44:01 +0000 Subject: [PATCH] Move Serializable from interface to implementations git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@777894 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/math/analysis/MultivariateRealFunction.java | 4 +--- .../math/analysis/MultivariateVectorialFunction.java | 4 +--- .../commons/math/analysis/UnivariateMatrixFunction.java | 4 +--- .../commons/math/analysis/UnivariateRealFunction.java | 4 +--- .../commons/math/analysis/UnivariateVectorialFunction.java | 4 +--- .../commons/math/optimization/LeastSquaresConverter.java | 6 +++++- .../general/NonLinearConjugateGradientOptimizer.java | 6 +++++- .../org/apache/commons/math/analysis/Expm1Function.java | 4 +++- .../apache/commons/math/analysis/MonitoredFunction.java | 4 +++- src/test/org/apache/commons/math/analysis/SinFunction.java | 4 +++- .../optimization/general/GaussNewtonOptimizerTest.java | 5 +++-- .../general/LevenbergMarquardtOptimizerTest.java | 7 ++++--- .../commons/math/optimization/general/MinpackTest.java | 3 ++- .../general/NonLinearConjugateGradientOptimizerTest.java | 5 +++-- 14 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/java/org/apache/commons/math/analysis/MultivariateRealFunction.java b/src/java/org/apache/commons/math/analysis/MultivariateRealFunction.java index 008810dfe..a61ce9b23 100644 --- a/src/java/org/apache/commons/math/analysis/MultivariateRealFunction.java +++ b/src/java/org/apache/commons/math/analysis/MultivariateRealFunction.java @@ -17,8 +17,6 @@ package org.apache.commons.math.analysis; -import java.io.Serializable; - import org.apache.commons.math.FunctionEvaluationException; /** @@ -26,7 +24,7 @@ import org.apache.commons.math.FunctionEvaluationException; * @version $Revision$ $Date$ * @since 2.0 */ -public interface MultivariateRealFunction extends Serializable { +public interface MultivariateRealFunction { /** * Compute the value for the function at the given point. diff --git a/src/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java b/src/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java index 9babee9f2..6beed27de 100644 --- a/src/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java +++ b/src/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java @@ -17,8 +17,6 @@ package org.apache.commons.math.analysis; -import java.io.Serializable; - import org.apache.commons.math.FunctionEvaluationException; /** @@ -26,7 +24,7 @@ import org.apache.commons.math.FunctionEvaluationException; * @version $Revision$ $Date$ * @since 2.0 */ -public interface MultivariateVectorialFunction extends Serializable { +public interface MultivariateVectorialFunction { /** * Compute the value for the function at the given point. diff --git a/src/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java b/src/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java index 79d7efbf9..38dd000d5 100644 --- a/src/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java +++ b/src/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java @@ -16,8 +16,6 @@ */ package org.apache.commons.math.analysis; -import java.io.Serializable; - import org.apache.commons.math.FunctionEvaluationException; /** @@ -26,7 +24,7 @@ import org.apache.commons.math.FunctionEvaluationException; * @version $Revision$ $Date$ * @since 2.0 */ -public interface UnivariateMatrixFunction extends Serializable { +public interface UnivariateMatrixFunction { /** * Compute the value for the function. * @param x the point for which the function value should be computed diff --git a/src/java/org/apache/commons/math/analysis/UnivariateRealFunction.java b/src/java/org/apache/commons/math/analysis/UnivariateRealFunction.java index bd79bc6e0..457ada762 100644 --- a/src/java/org/apache/commons/math/analysis/UnivariateRealFunction.java +++ b/src/java/org/apache/commons/math/analysis/UnivariateRealFunction.java @@ -16,8 +16,6 @@ */ package org.apache.commons.math.analysis; -import java.io.Serializable; - import org.apache.commons.math.FunctionEvaluationException; /** @@ -25,7 +23,7 @@ import org.apache.commons.math.FunctionEvaluationException; * * @version $Revision$ $Date$ */ -public interface UnivariateRealFunction extends Serializable { +public interface UnivariateRealFunction { /** * Compute the value for the function. * @param x the point for which the function value should be computed diff --git a/src/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java b/src/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java index eb5138327..fdcc1a773 100644 --- a/src/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java +++ b/src/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java @@ -16,8 +16,6 @@ */ package org.apache.commons.math.analysis; -import java.io.Serializable; - import org.apache.commons.math.FunctionEvaluationException; /** @@ -26,7 +24,7 @@ import org.apache.commons.math.FunctionEvaluationException; * @version $Revision$ $Date$ * @since 2.0 */ -public interface UnivariateVectorialFunction extends Serializable { +public interface UnivariateVectorialFunction { /** * Compute the value for the function. * @param x the point for which the function value should be computed diff --git a/src/java/org/apache/commons/math/optimization/LeastSquaresConverter.java b/src/java/org/apache/commons/math/optimization/LeastSquaresConverter.java index a0238732c..7c00b3634 100644 --- a/src/java/org/apache/commons/math/optimization/LeastSquaresConverter.java +++ b/src/java/org/apache/commons/math/optimization/LeastSquaresConverter.java @@ -17,6 +17,8 @@ package org.apache.commons.math.optimization; +import java.io.Serializable; + import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.MathRuntimeException; import org.apache.commons.math.analysis.MultivariateRealFunction; @@ -54,7 +56,9 @@ import org.apache.commons.math.linear.RealMatrix; * @since 2.0 */ -public class LeastSquaresConverter implements MultivariateRealFunction { +public class LeastSquaresConverter implements MultivariateRealFunction, Serializable { + // TODO: Add Serializable documentation + // TODO: Check Serializable implementation /** Serializable version identifier. */ private static final long serialVersionUID = -4369653306135732243L; diff --git a/src/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java b/src/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java index c1edaa37b..b38e967f7 100644 --- a/src/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java +++ b/src/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java @@ -17,6 +17,8 @@ package org.apache.commons.math.optimization.general; +import java.io.Serializable; + import org.apache.commons.math.ConvergenceException; import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.analysis.UnivariateRealFunction; @@ -261,7 +263,9 @@ public class NonLinearConjugateGradientOptimizer * extremum along the search direction. *

*/ - private class LineSearchFunction implements UnivariateRealFunction { + private class LineSearchFunction implements UnivariateRealFunction, Serializable { + // TODO: Add Serializable documentation + // TODO: Check Serializable implementation /** Serializable version identifier. */ private static final long serialVersionUID = 8184683950487801424L; diff --git a/src/test/org/apache/commons/math/analysis/Expm1Function.java b/src/test/org/apache/commons/math/analysis/Expm1Function.java index b43e368c6..97268ba91 100644 --- a/src/test/org/apache/commons/math/analysis/Expm1Function.java +++ b/src/test/org/apache/commons/math/analysis/Expm1Function.java @@ -16,6 +16,8 @@ */ package org.apache.commons.math.analysis; +import java.io.Serializable; + import org.apache.commons.math.FunctionEvaluationException; /** @@ -23,7 +25,7 @@ import org.apache.commons.math.FunctionEvaluationException; * * @version $Revision$ $Date$ */ -public class Expm1Function implements DifferentiableUnivariateRealFunction { +public class Expm1Function implements DifferentiableUnivariateRealFunction, Serializable { private static final long serialVersionUID = 1410052725961159179L; diff --git a/src/test/org/apache/commons/math/analysis/MonitoredFunction.java b/src/test/org/apache/commons/math/analysis/MonitoredFunction.java index 04069e02a..e93d81c89 100644 --- a/src/test/org/apache/commons/math/analysis/MonitoredFunction.java +++ b/src/test/org/apache/commons/math/analysis/MonitoredFunction.java @@ -16,6 +16,8 @@ */ package org.apache.commons.math.analysis; +import java.io.Serializable; + import org.apache.commons.math.FunctionEvaluationException; /** @@ -23,7 +25,7 @@ import org.apache.commons.math.FunctionEvaluationException; * * @version $Revision$ $Date$ */ -public class MonitoredFunction implements UnivariateRealFunction { +public class MonitoredFunction implements UnivariateRealFunction, Serializable { private static final long serialVersionUID = -8403645545888892674L; diff --git a/src/test/org/apache/commons/math/analysis/SinFunction.java b/src/test/org/apache/commons/math/analysis/SinFunction.java index 45389bbd1..6b80c7d67 100644 --- a/src/test/org/apache/commons/math/analysis/SinFunction.java +++ b/src/test/org/apache/commons/math/analysis/SinFunction.java @@ -16,6 +16,8 @@ */ package org.apache.commons.math.analysis; +import java.io.Serializable; + import org.apache.commons.math.FunctionEvaluationException; /** @@ -28,7 +30,7 @@ import org.apache.commons.math.FunctionEvaluationException; * * @version $Revision$ $Date$ */ -public class SinFunction implements DifferentiableUnivariateRealFunction { +public class SinFunction implements DifferentiableUnivariateRealFunction, Serializable { private static final long serialVersionUID = 6422911699694536977L; diff --git a/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java b/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java index d2336fb5c..beafe9dcb 100644 --- a/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java +++ b/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java @@ -18,6 +18,7 @@ package org.apache.commons.math.optimization.general; import java.awt.geom.Point2D; +import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; @@ -478,7 +479,7 @@ extends TestCase { } - private static class LinearProblem implements DifferentiableMultivariateVectorialFunction { + private static class LinearProblem implements DifferentiableMultivariateVectorialFunction, Serializable { private static final long serialVersionUID = -8804268799379350190L; final RealMatrix factors; @@ -503,7 +504,7 @@ extends TestCase { } - private static class Circle implements DifferentiableMultivariateVectorialFunction { + private static class Circle implements DifferentiableMultivariateVectorialFunction, Serializable { private static final long serialVersionUID = -7165774454925027042L; private ArrayList points; diff --git a/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java b/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java index 42e89e7d7..f142e18f1 100644 --- a/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java +++ b/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java @@ -18,6 +18,7 @@ package org.apache.commons.math.optimization.general; import java.awt.geom.Point2D; +import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -518,7 +519,7 @@ public class LevenbergMarquardtOptimizerTest } - private static class LinearProblem implements DifferentiableMultivariateVectorialFunction { + private static class LinearProblem implements DifferentiableMultivariateVectorialFunction, Serializable { private static final long serialVersionUID = 703247177355019415L; final RealMatrix factors; @@ -543,7 +544,7 @@ public class LevenbergMarquardtOptimizerTest } - private static class Circle implements DifferentiableMultivariateVectorialFunction { + private static class Circle implements DifferentiableMultivariateVectorialFunction, Serializable { private static final long serialVersionUID = -4711170319243817874L; @@ -624,7 +625,7 @@ public class LevenbergMarquardtOptimizerTest } - private static class QuadraticProblem implements DifferentiableMultivariateVectorialFunction { + private static class QuadraticProblem implements DifferentiableMultivariateVectorialFunction, Serializable { private static final long serialVersionUID = 7072187082052755854L; private List x; diff --git a/src/test/org/apache/commons/math/optimization/general/MinpackTest.java b/src/test/org/apache/commons/math/optimization/general/MinpackTest.java index ec2e9dd5e..d7f409ec3 100644 --- a/src/test/org/apache/commons/math/optimization/general/MinpackTest.java +++ b/src/test/org/apache/commons/math/optimization/general/MinpackTest.java @@ -17,6 +17,7 @@ package org.apache.commons.math.optimization.general; +import java.io.Serializable; import java.util.Arrays; import junit.framework.Test; @@ -510,7 +511,7 @@ public class MinpackTest extends TestCase { } private static abstract class MinpackFunction - implements DifferentiableMultivariateVectorialFunction { + implements DifferentiableMultivariateVectorialFunction, Serializable { private static final long serialVersionUID = -6209760235478794233L; protected int n; diff --git a/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java b/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java index 7f72d924c..e0482975f 100644 --- a/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java +++ b/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java @@ -18,6 +18,7 @@ package org.apache.commons.math.optimization.general; import java.awt.geom.Point2D; +import java.io.Serializable; import java.util.ArrayList; import junit.framework.Test; @@ -363,7 +364,7 @@ extends TestCase { assertEquals(48.135167894, center.y, 1.0e-8); } - private static class LinearProblem implements DifferentiableMultivariateRealFunction { + private static class LinearProblem implements DifferentiableMultivariateRealFunction, Serializable { private static final long serialVersionUID = 703247177355019415L; final RealMatrix factors; @@ -415,7 +416,7 @@ extends TestCase { } - private static class Circle implements DifferentiableMultivariateRealFunction { + private static class Circle implements DifferentiableMultivariateRealFunction, Serializable { private static final long serialVersionUID = -4711170319243817874L;