You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/06/29 17:20:24 UTC

svn commit: r789358 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/ode/sampling/ test/org/apache/commons/math/ode/sampling/

Author: luc
Date: Mon Jun 29 15:20:22 2009
New Revision: 789358

URL: http://svn.apache.org/viewvc?rev=789358&view=rev
Log:
fixed a serialization error introduced by yesterday changes
(sorry for the noise)

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java?rev=789358&r1=789357&r2=789358&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java Mon Jun 29 15:20:22 2009
@@ -362,7 +362,7 @@
 
   /** {@inheritDoc} */
   public abstract void readExternal(ObjectInput in)
-    throws IOException;
+    throws IOException, ClassNotFoundException;
 
   /** Save the base state of the instance.
    * This method performs step finalization if it has not been done

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java?rev=789358&r1=789357&r2=789358&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java Mon Jun 29 15:20:22 2009
@@ -187,18 +187,64 @@
     @Override
     public void writeExternal(final ObjectOutput out)
         throws IOException {
+
+        // save the state of the base class
         writeBaseExternal(out);
+
+        // save the local attributes
+        out.writeDouble(scalingH);
+        out.writeDouble(referenceTime);
+
+        final int n = (currentState == null) ? -1 : currentState.length;
+        if (scaled == null) {
+            out.writeBoolean(false);
+        } else {
+            out.writeBoolean(true);
+            for (int j = 0; j < n; ++j) {
+                out.writeDouble(scaled[j]);
+            }
+        }
+
+        if (nordsieck == null) {
+            out.writeBoolean(false);
+        } else {
+            out.writeBoolean(true);
+            out.writeObject(nordsieck);
+        }
+
     }
 
     /** {@inheritDoc} */
     @Override
     public void readExternal(final ObjectInput in)
-        throws IOException {
+        throws IOException, ClassNotFoundException {
 
         // read the base class 
         final double t = readBaseExternal(in);
 
-        if ((scaled != null) && (nordsieck != null)) {
+        // read the local attributes
+        scalingH      = in.readDouble();
+        referenceTime = in.readDouble();
+
+        final int n = (currentState == null) ? -1 : currentState.length;
+        final boolean hasScaled = in.readBoolean();
+        if (hasScaled) {
+            scaled = new double[n];
+            for (int j = 0; j < n; ++j) {
+                scaled[j] = in.readDouble();
+            }
+        } else {
+            scaled = null;
+        }
+
+        final boolean hasNordsieck = in.readBoolean();
+        if (hasNordsieck) {
+            nordsieck = (Array2DRowRealMatrix) in.readObject();
+        } else {
+            nordsieck = null;
+        }
+
+        if (hasScaled && hasNordsieck) {
             // we can now set the interpolated time and state
             setInterpolatedTime(t);
         }

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java?rev=789358&r1=789357&r2=789358&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java Mon Jun 29 15:20:22 2009
@@ -62,8 +62,8 @@
             oos.writeObject(handler);
         }
 
-        assertTrue(bos.size () >  16000);
-        assertTrue(bos.size () <  17000);
+        assertTrue(bos.size () >  20000);
+        assertTrue(bos.size () <  25000);
 
         ByteArrayInputStream  bis = new ByteArrayInputStream(bos.toByteArray());
         ObjectInputStream     ois = new ObjectInputStream(bis);