From 432d017bbf6a0d01b407183c743cf003bb4eeef5 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 12 Feb 2016 13:54:35 +0000 Subject: [PATCH] explicit.StateValues: add createFromIntegerArray (analogue to createFromBitSet, createFromDoubleArray) git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11189 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/explicit/StateValues.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/prism/src/explicit/StateValues.java b/prism/src/explicit/StateValues.java index f936d72d..35adb44c 100644 --- a/prism/src/explicit/StateValues.java +++ b/prism/src/explicit/StateValues.java @@ -157,6 +157,21 @@ public class StateValues implements StateVector } } + /** + * Create a new (int-valued) state values vector from an existing array of ints. + * The array is stored directly, not copied. + * Also set associated model (whose state space size should match vector size). + */ + public static StateValues createFromIntegerArray(int[] array, Model model) + { + StateValues sv = new StateValues(); + sv.type = TypeInt.getInstance(); + sv.size = array.length; + sv.valuesI = array; + sv.statesList = model.getStatesList(); + return sv; + } + /** * Create a new (double-valued) state values vector from an existing array of doubles. * The array is stored directly, not copied.