Browse Source

Utility array copy methods.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@5383 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 14 years ago
parent
commit
09f8b2b8d9
  1. 36
      prism/src/explicit/Utils.java

36
prism/src/explicit/Utils.java

@ -165,6 +165,42 @@ public class Utils
return arrayNew; return arrayNew;
} }
/**
* Copy a double array.
* @param array The array to be cloned
* @param copy The destination array (should exist and be same size)
*/
public static void copyDoubleArray(double array[], double copyTo[])
{
int i, n;
// Do nothing for null pointers
if (array == null)
return;
// Otherwise copy
n = array.length;
for (i = 0; i < n; i++) {
copyTo[i] = array[i];
}
}
/**
* Copy an integer array.
* @param array The array to be cloned
* @param copy The destination array (should exist and be same size)
*/
public static void copyIntArray(int array[], int copyTo[])
{
int i, n;
// Do nothing for null pointers
if (array == null)
return;
// Otherwise copy
n = array.length;
for (i = 0; i < n; i++) {
copyTo[i] = array[i];
}
}
/** /**
* Test if two double arrays are equal. * Test if two double arrays are equal.
*/ */

Loading…
Cancel
Save