]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
(fixes #5379) Loading IC publishes intermediate results for each change
authorjussi.koskela <jussi.koskela@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 9 Oct 2014 07:31:42 +0000 (07:31 +0000)
committerjussi.koskela <jussi.koskela@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 9 Oct 2014 07:31:42 +0000 (07:31 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30389 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/manager/OldSysdynExperiment.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiments.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentInternal.java

index 0a2868a20c6615338c79a150e72800adcd3aceca..9f1332c22d3903caa8ab25e2133666ab6f21d871 100644 (file)
@@ -847,10 +847,16 @@ public class OldSysdynExperiment extends SysdynExperiment {
     public void resultsChanged() {\r
        resultsChanged(false);\r
     }\r
+\r
+    protected void onPublishResults() {\r
+               resultsChanged(true);\r
+    }\r
     \r
     public void setPublishResults(boolean value) {\r
        publishResults = value;\r
-       if(publishResults) resultsChanged(true);\r
+       if(publishResults) {\r
+               onPublishResults();\r
+       }\r
     }\r
 \r
     public void resultsChanged(boolean force) {\r
index a2d35c7dd1273cc819f10bc5d24a69613797d3c4..0253f9a5bbbbb20678848d24cb0fe69b7e143f38 100644 (file)
@@ -318,8 +318,13 @@ public class SysdynExperiments {
        \r
                Variable base = Variables.getVariable(graph, run);\r
                \r
+               SysdynExperiments.setPublishResults(graph, base, false);\r
+               \r
                PartialIC data = graph.getPossibleRelatedValue(ic, SYSDYN.InitialCondition_HasInitialValues, PartialIC.BINDING);\r
                data.apply(graph, base);\r
+               \r
+               SysdynExperiments.setPublishResults(graph, base, true);\r
+\r
        \r
     }\r
     \r
index c4de04a1da5b99e8e00a5d4e11b19b753b14c7c7..31314bbdf4df9e7ac046b41924679428e33f30af 100644 (file)
@@ -18,10 +18,12 @@ import java.util.Collection;
 import java.util.HashMap;\r
 \r
 import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.NullProgressMonitor;\r
 import org.eclipse.core.runtime.jobs.Job;\r
 import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.Logger;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.procedure.AsyncListener;\r
 import org.simantics.db.request.Read;\r
@@ -214,5 +216,16 @@ abstract public class SysdynGameExperimentBase extends OldSysdynExperiment {
        }\r
        \r
     }\r
+\r
+    @Override\r
+    protected void onPublishResults() {\r
+       try {\r
+                       setSubscribedResults(new NullProgressMonitor(), getSolver().getTime());\r
+               } catch (FMUJNIException e) {\r
+                       Logger.defaultLogError(e);\r
+               }\r
+               ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription));\r
+               super.onPublishResults();\r
+    }\r
     \r
 }\r
index 1dfc9a8d676ca7af19de84c2b5fd438386be6c37..71025a735443b329df6f16984bdbbf41d477237e 100644 (file)
@@ -153,9 +153,11 @@ public class SysdynGameExperimentInternal extends SysdynGameExperimentBase {
        @Override\r
        public void refresh() {\r
                try {\r
-                       setSubscribedResults(new NullProgressMonitor(), solver.getTime());\r
-       \r
-                       ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription));\r
+                       \r
+                       if(publishResults) {\r
+                               setSubscribedResults(new NullProgressMonitor(), solver.getTime());\r
+                               ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription));\r
+                       }\r
        \r
                        resultsChanged(true);\r
                } catch (Exception e) {\r