Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Attempt to solve issues with our own finalize
[simgrid.git] / src / bindings / java / org / simgrid / msg / RngStream.java
index 6d5638c..e286c4a 100644 (file)
@@ -41,17 +41,15 @@ public class RngStream {
         * The natively implemented method to create a C RngStream object.
         */
        private native void create(String name);
-       /**
-        * Destructor
-        */
-       protected void finalize() {
-               destroy();
+
+       protected void finalize() throws Throwable{
+               nativeFinalize();
        }
        /**
         * Release the C RngStream object
         */
-       private native void destroy();
-       
+       private native void nativeFinalize();
+
        /**
         * Sets the initial seed of the package RngStreams to the six integers in the vector seed. This will
         * be the seed (initial state) of the first stream. If this procedure is not called, the default initial
@@ -59,7 +57,7 @@ public class RngStream {
         * must all be less than m1 = 4294967087, and not all 0; and the last 3 values must all be less
         * than m2 = 4294944443, and not all 0. Returns false for invalid seeds, and true otherwise.
         */
-       public static native boolean setPackageSeed(int seed[]);
+       public static native boolean setPackageSeed(int[] seed);
        /**
         * Reinitializes the stream g to its initial state: Cg and Bg are set to Ig .
         */
@@ -79,21 +77,21 @@ public class RngStream {
         */
        public native void setAntithetic(boolean a);
        /**
-         * Sets the initial seed Ig of stream g to the vector seed. This vector must satisfy the same
-         * conditions as in setPackageSeed. The stream is then reset to this initial seed. The
-         * states and seeds of the other streams are not modified. As a result, after calling this procedure,
-         * the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of
-         * this procedure. Returns false for invalid seeds, and true otherwise.
+        * Sets the initial seed Ig of stream g to the vector seed. This vector must satisfy the same
+        * conditions as in setPackageSeed. The stream is then reset to this initial seed. The
+        * states and seeds of the other streams are not modified. As a result, after calling this procedure,
+        * the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of
+        * this procedure. Returns false for invalid seeds, and true otherwise.
         */
-       public native boolean setSeed(int seed[]);
+       public native boolean setSeed(int[] seed);
        /**
-         * Advances the state of the stream by k values, without modifying the states of other streams (as
-         * in RngStream_SetSeed), nor the values of Bg and Ig associated with this stream. If e > 0, then
-         * k = 2e + c; if e < 0, then k = -2-e + c; and if e = 0, then k = c. Note: c is allowed to take
-         * negative values. We discourage the use of this procedure.    
-         */
+        * Advances the state of the stream by k values, without modifying the states of other streams (as
+        * in RngStream_SetSeed), nor the values of Bg and Ig associated with this stream. If e &gt; 0, then
+        * k = 2e + c; if e &lt; 0, then k = -2-e + c; and if e = 0, then k = c. Note: c is allowed to take
+        * negative values. We discourage the use of this procedure.     
+        */
        public native void advanceState(int e, int g);
-       
+
        /**
         * Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), after advancing the state by one step. The returned number has 32 bits of precision
         * in the sense that it is always a multiple of 1/(232 - 208), unless RngStream_IncreasedPrecis
@@ -105,13 +103,13 @@ public class RngStream {
         * {i, i + 1, . . . , j}
         */
        public native int randInt(int i, int j);
-       
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
        public static native void nativeInit();
        static {
-               Msg.nativeInit();
+               org.simgrid.NativeLib.nativeInit();
                nativeInit();
        }
-}
\ No newline at end of file
+}