commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [math] Code update (following change in "Commons RNG").
Date Thu, 03 Nov 2016 18:15:36 GMT
Repository: commons-math
Updated Branches:
  refs/heads/master 72df12fb2 -> 7b42d43fa


Code update (following change in "Commons RNG").


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

Branch: refs/heads/master
Commit: 7b42d43fa0827557f51cb4111c89fb2a78512c68
Parents: 72df12f
Author: Gilles <gilles@harfang.homelinux.org>
Authored: Thu Nov 3 21:12:12 2016 +0100
Committer: Gilles <gilles@harfang.homelinux.org>
Committed: Thu Nov 3 21:12:12 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/commons/math4/random/RngAdaptor.java  | 10 +++++-----
 .../apache/commons/math4/util/RandomPivotingStrategy.java |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b42d43f/src/main/java/org/apache/commons/math4/random/RngAdaptor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RngAdaptor.java b/src/main/java/org/apache/commons/math4/random/RngAdaptor.java
index 4603f4e..3c365af 100644
--- a/src/main/java/org/apache/commons/math4/random/RngAdaptor.java
+++ b/src/main/java/org/apache/commons/math4/random/RngAdaptor.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.rng.UniformRandomProvider;
+import org.apache.commons.rng.RestorableUniformRandomProvider;
 import org.apache.commons.rng.RandomSource;
 
 /**
@@ -52,7 +52,7 @@ import org.apache.commons.rng.RandomSource;
  *  </li>
  *  <li>
  *   The new RNG implementations are not {@code Serializable}.
- *   Use {@link RandomSource#saveState(UniformRandomProvider)}
+ *   Use {@link RestorableUniformRandomProvider#saveState()}
  *   instead.
  *  </li>
  *  <li>
@@ -79,7 +79,7 @@ public final class RngAdaptor
     /** Source. */
     private final RandomSource source;
     /** Delegate. */
-    private transient UniformRandomProvider delegate;
+    private transient RestorableUniformRandomProvider delegate;
     /** Next gaussian. */
     private double nextGaussian = Double.NaN;
 
@@ -206,7 +206,7 @@ public final class RngAdaptor
         out.defaultWriteObject();
 
         // Save current state.
-        out.writeObject(RandomSource.saveState(delegate).getState());
+        out.writeObject(((RandomSource.State) delegate.saveState()).getState());
    }
 
     /**
@@ -224,6 +224,6 @@ public final class RngAdaptor
         delegate = RandomSource.create(source);
         // And restore its state.
         final RandomSource.State state = new RandomSource.State((byte[]) in.readObject());
-        RandomSource.restoreState(delegate, state);
+        delegate.restoreState(state);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b42d43f/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java b/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
index af0f5e1..ddcaf28 100644
--- a/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
+++ b/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import org.apache.commons.math4.exception.MathIllegalArgumentException;
-import org.apache.commons.rng.UniformRandomProvider;
+import org.apache.commons.rng.RestorableUniformRandomProvider;
 import org.apache.commons.rng.RandomSource;
 
 /**
@@ -35,7 +35,7 @@ public class RandomPivotingStrategy implements PivotingStrategyInterface,
Serial
     /** Source of randomness. */
     private final RandomSource randomSource;
     /** Random generator to use for selecting pivot. */
-    private transient UniformRandomProvider random;
+    private transient RestorableUniformRandomProvider random;
 
     /**
      * Simple constructor.
@@ -77,7 +77,7 @@ public class RandomPivotingStrategy implements PivotingStrategyInterface,
Serial
         out.defaultWriteObject();
 
         // Save current state.
-        out.writeObject(RandomSource.saveState(random).getState());
+        out.writeObject(((RandomSource.State) random.saveState()).getState());
    }
 
     /**
@@ -95,6 +95,6 @@ public class RandomPivotingStrategy implements PivotingStrategyInterface,
Serial
         random = RandomSource.create(randomSource);
         // And restore its state.
         final RandomSource.State state = new RandomSource.State((byte[]) in.readObject());
-        RandomSource.restoreState(random, state);
+        random.restoreState(state);
     }
 }


Mime
View raw message