From 09f8b2b8d9f036c90129e09061e049da35a8fc3a Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Wed, 27 Jun 2012 07:30:51 +0000 Subject: [PATCH] Utility array copy methods. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@5383 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/explicit/Utils.java | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/prism/src/explicit/Utils.java b/prism/src/explicit/Utils.java index 07a6b90f..47e5c4a4 100644 --- a/prism/src/explicit/Utils.java +++ b/prism/src/explicit/Utils.java @@ -165,6 +165,42 @@ public class Utils 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. */