From 159cb06dce18ce64c35f52a58e7af4f24f316686 Mon Sep 17 00:00:00 2001 From: jkauttio Date: Wed, 30 Apr 2014 12:09:50 +0000 Subject: [PATCH] Change dataset manipulation for simulation results to also include enumeration indices in variable names (that were previously removed for some reason) fixes #4851 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29401 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../adapter/ActiveDatasetsIndexVariable.java | 48 +++++++------------ 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ActiveDatasetsIndexVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ActiveDatasetsIndexVariable.java index 24293812..4b57b97d 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ActiveDatasetsIndexVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ActiveDatasetsIndexVariable.java @@ -21,42 +21,28 @@ public class ActiveDatasetsIndexVariable extends IndexVariable< ArrayList getValue() { ArrayList datasets = new ArrayList(); - + if(experiment == null) - return datasets; - + return datasets; + Collection results = experiment.getActiveResults(); ArrayList variableNamesWithIndexes = getVariableNamesWithIndexNumbers(); ArrayList variableNames = getVariableNames(); for(int i = 0; i < variableNamesWithIndexes.size(); i++) { - for(SysdynResult result : results) { - SysdynDataSet ds = result.getDataSet(variableNamesWithIndexes.get(i)); - if(ds != null) { - - /* Change the name if necessary - Name needs to be changed if it contains indexes. Dataset names - contains indexes as numbers, asked names as index names. - - There are cases where dataset names could actually be different - from asked names. HistoryDatasets are one example. In that case, show the - datasetname. - */ - String askedName = variableNames.get(i); - if(askedName.contains("[")) - askedName = askedName.substring(0, askedName.indexOf("[")); - String datasetname = ds.name.replace("_", " "); - if(datasetname.contains("[")) - datasetname = datasetname.substring(0, datasetname.indexOf("[")); - - if(askedName.equals(datasetname.replace("_", " "))) - ds.name = askedName; - else - ds.name = datasetname; - - datasets.add(ds); - } - } + for(SysdynResult result : results) { + SysdynDataSet ds = result.getDataSet(variableNamesWithIndexes.get(i)); + if(ds != null) { + // NOTE: this method was changed to no longer remove + // remove enumeration indices from variable names as it + // seems unnecessary and makes different instances of the + // same variable with different enumeration indices + // indistinguishable from each other in simulation results + ds.name = variableNames.get(i); + + datasets.add(ds); + } + } } return datasets; } @@ -64,7 +50,7 @@ public class ActiveDatasetsIndexVariable extends IndexVariable< ArrayList