commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [1/2] [math] Restrictied fields visibility in tests.
Date Sun, 22 Nov 2015 19:50:06 GMT
Repository: commons-math
Updated Branches:
  refs/heads/field-ode a15e4901b -> 795448200


Restrictied fields visibility in tests.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/4b698fbf
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/4b698fbf
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/4b698fbf

Branch: refs/heads/field-ode
Commit: 4b698fbf7918f0197ac4646adb3c1f405d4b0699
Parents: a15e490
Author: Luc Maisonobe <luc@apache.org>
Authored: Sun Nov 22 20:49:16 2015 +0100
Committer: Luc Maisonobe <luc@apache.org>
Committed: Sun Nov 22 20:49:16 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/commons/math3/ode/TestProblem1.java |  8 ++++----
 .../java/org/apache/commons/math3/ode/TestProblem2.java |  4 ++--
 .../java/org/apache/commons/math3/ode/TestProblem5.java |  2 +-
 .../java/org/apache/commons/math3/ode/TestProblem6.java |  4 ++--
 .../apache/commons/math3/ode/TestProblemAbstract.java   | 12 ++++++------
 5 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/4b698fbf/src/test/java/org/apache/commons/math3/ode/TestProblem1.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/TestProblem1.java b/src/test/java/org/apache/commons/math3/ode/TestProblem1.java
index 8344904..6cb7c9f 100644
--- a/src/test/java/org/apache/commons/math3/ode/TestProblem1.java
+++ b/src/test/java/org/apache/commons/math3/ode/TestProblem1.java
@@ -56,16 +56,16 @@ public class TestProblem1
   public void doComputeDerivatives(double t, double[] y, double[] yDot) {
 
     // compute the derivatives
-    for (int i = 0; i < n; ++i)
+    for (int i = 0; i < getDimension(); ++i)
       yDot[i] = -y[i];
 
   }
 
   @Override
   public double[] computeTheoreticalState(double t) {
-    double c = FastMath.exp (t0 - t);
-    for (int i = 0; i < n; ++i) {
-      y[i] = c * y0[i];
+    double c = FastMath.exp (getInitialTime() - t);
+    for (int i = 0; i < getDimension(); ++i) {
+      y[i] = c * getInitialState()[i];
     }
     return y;
   }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/4b698fbf/src/test/java/org/apache/commons/math3/ode/TestProblem2.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/TestProblem2.java b/src/test/java/org/apache/commons/math3/ode/TestProblem2.java
index 912c4d8..877d8a5 100644
--- a/src/test/java/org/apache/commons/math3/ode/TestProblem2.java
+++ b/src/test/java/org/apache/commons/math3/ode/TestProblem2.java
@@ -57,7 +57,7 @@ public class TestProblem2
   public void doComputeDerivatives(double t, double[] y, double[] yDot) {
 
     // compute the derivatives
-    for (int i = 0; i < n; ++i)
+    for (int i = 0; i < getDimension(); ++i)
       yDot[i] = t * (t * t - y[i]);
 
   }
@@ -66,7 +66,7 @@ public class TestProblem2
   public double[] computeTheoreticalState(double t) {
     double t2 = t * t;
     double c = t2 + 2 * (FastMath.exp (-0.5 * t2) - 1);
-    for (int i = 0; i < n; ++i) {
+    for (int i = 0; i < getDimension(); ++i) {
       y[i] = c;
     }
     return y;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/4b698fbf/src/test/java/org/apache/commons/math3/ode/TestProblem5.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/TestProblem5.java b/src/test/java/org/apache/commons/math3/ode/TestProblem5.java
index 8bb04e0..3dbe56f 100644
--- a/src/test/java/org/apache/commons/math3/ode/TestProblem5.java
+++ b/src/test/java/org/apache/commons/math3/ode/TestProblem5.java
@@ -28,7 +28,7 @@ public class TestProblem5 extends TestProblem1 {
    * Simple constructor.
    */
     public TestProblem5() {
-        setFinalConditions(2 * t0 - t1);
+        setFinalConditions(2 * getInitialTime() - getFinalTime());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/4b698fbf/src/test/java/org/apache/commons/math3/ode/TestProblem6.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/TestProblem6.java b/src/test/java/org/apache/commons/math3/ode/TestProblem6.java
index 6d69158..a61bf0a 100644
--- a/src/test/java/org/apache/commons/math3/ode/TestProblem6.java
+++ b/src/test/java/org/apache/commons/math3/ode/TestProblem6.java
@@ -58,7 +58,7 @@ public class TestProblem6
         double t2 = t  * t;
         double t4 = t2 * t2;
         double t5 = t4 * t;
-        for (int i = 0; i < n; ++i) {
+        for (int i = 0; i < getDimension(); ++i) {
             yDot[i] = 3 * t5 - y[i];
         }
 
@@ -66,7 +66,7 @@ public class TestProblem6
 
     @Override
     public double[] computeTheoreticalState(double t) {
-        for (int i = 0; i < n; ++i) {
+        for (int i = 0; i < getDimension(); ++i) {
             y[i] = ((((3 * t - 15) * t + 60) * t - 180) * t + 360) * t - 360;
         }
         return y;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/4b698fbf/src/test/java/org/apache/commons/math3/ode/TestProblemAbstract.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/TestProblemAbstract.java b/src/test/java/org/apache/commons/math3/ode/TestProblemAbstract.java
index e17eda5..c1a73a0 100644
--- a/src/test/java/org/apache/commons/math3/ode/TestProblemAbstract.java
+++ b/src/test/java/org/apache/commons/math3/ode/TestProblemAbstract.java
@@ -28,22 +28,22 @@ public abstract class TestProblemAbstract
   implements FirstOrderDifferentialEquations {
 
   /** Dimension of the problem. */
-  protected int n;
+  private int n;
 
   /** Number of functions calls. */
-  protected int calls;
+  private int calls;
 
   /** Initial time */
-  protected double t0;
+  private double t0;
 
   /** Initial state */
-  protected double[] y0;
+  private double[] y0;
 
   /** Final time */
-  protected double t1;
+  private double t1;
 
   /** Error scale */
-  protected double[] errorScale;
+  private double[] errorScale;
 
   /**
    * Simple constructor.


Mime
View raw message