]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Change dataset manipulation for simulation results to also include enumeration indice...
authorjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 30 Apr 2014 12:09:50 +0000 (12:09 +0000)
committerjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 30 Apr 2014 12:09:50 +0000 (12:09 +0000)
fixes #4851

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29401 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ActiveDatasetsIndexVariable.java

index 242938125eb51fe0761fb025ca962106124bb336..4b57b97d3257b1bd34a5aca5c37b3cf981c12a41 100644 (file)
@@ -21,42 +21,28 @@ public class ActiveDatasetsIndexVariable extends IndexVariable< ArrayList<DataSe
        @Override\r
        public  ArrayList<DataSet> getValue() {\r
                ArrayList<DataSet> datasets = new ArrayList<DataSet>();\r
-               \r
+\r
                if(experiment == null)\r
-                   return datasets;\r
-               \r
+                       return datasets;\r
+\r
                Collection<SysdynResult> results = experiment.getActiveResults();\r
                ArrayList<String> variableNamesWithIndexes = getVariableNamesWithIndexNumbers();\r
                ArrayList<String> variableNames = getVariableNames();\r
 \r
                for(int i = 0; i < variableNamesWithIndexes.size(); i++) {\r
-                   for(SysdynResult result : results) {\r
-                       SysdynDataSet ds = result.getDataSet(variableNamesWithIndexes.get(i));\r
-                       if(ds != null) {\r
-                           \r
-                           /* Change the name if necessary\r
-                            Name needs to be changed if it contains indexes. Dataset names\r
-                            contains indexes as numbers, asked names as index names.\r
-                            \r
-                            There are cases where dataset names could actually be different \r
-                            from asked names. HistoryDatasets are one example. In that case, show the \r
-                            datasetname.\r
-                            */\r
-                           String askedName = variableNames.get(i);\r
-                           if(askedName.contains("["))\r
-                               askedName = askedName.substring(0, askedName.indexOf("["));\r
-                           String datasetname = ds.name.replace("_", " ");\r
-                           if(datasetname.contains("["))\r
-                               datasetname = datasetname.substring(0, datasetname.indexOf("["));\r
-                           \r
-                           if(askedName.equals(datasetname.replace("_", " ")))\r
-                               ds.name = askedName;\r
-                           else\r
-                               ds.name = datasetname;\r
-                           \r
-                           datasets.add(ds);\r
-                       }\r
-                   }\r
+                       for(SysdynResult result : results) {\r
+                               SysdynDataSet ds = result.getDataSet(variableNamesWithIndexes.get(i));\r
+                               if(ds != null) {\r
+                                       // NOTE: this method was changed to no longer remove\r
+                                       // remove enumeration indices from variable names as it\r
+                                       // seems unnecessary and makes different instances of the\r
+                                       // same variable with different enumeration indices\r
+                                       // indistinguishable from each other in simulation results\r
+                                       ds.name = variableNames.get(i);\r
+\r
+                                       datasets.add(ds);\r
+                               }\r
+                       }\r
                }\r
                return datasets;\r
        }\r
@@ -64,7 +50,7 @@ public class ActiveDatasetsIndexVariable extends IndexVariable< ArrayList<DataSe
        @Override\r
        public void setIndexedValue(WriteGraph graph, Object value)\r
                        throws DatabaseException {\r
-               \r
+\r
        }\r
 \r
 }\r