Minor refactoring in Simulator Toolkit 65/2465/1
authorAntti Villberg <antti.villberg@semantum.fi>
Fri, 16 Nov 2018 13:10:40 +0000 (15:10 +0200)
committerAntti Villberg <antti.villberg@semantum.fi>
Sat, 17 Nov 2018 06:30:44 +0000 (08:30 +0200)
gitlab #205

Change-Id: Id0f513093b83eb2cdcf4a087daca1edbc57b0363

bundles/org.simantics.simulator.toolkit.db/src/org/simantics/simulator/toolkit/db/StandardVariableNodeManager.java
bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardNodeManager.java
bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardRealm.java

index 883f8099f29a93ff717cfba3e86d173a2d70bbd8..a08d733d1374f78c0831e4071524a4b212d005a5 100644 (file)
@@ -31,15 +31,6 @@ public class StandardVariableNodeManager<Node, Engine extends StandardNodeManage
         this.support = new NodeSupport<>(this);
     }
 
-/*    public void registerNodeSupport(NodeSupport<Node> support) {
-        this.support = support;
-    }
-
-
-    public void registerSupport(NodeSupport<Node> support) {
-        this.support = support;
-    }*/
-
     @Override
     public void refreshVariable(Node node) {
         super.refreshVariable(node);
index b8a549087fdb1c745cb6287f95b5faf7ba88a892..402f3884d433270d9161594224d971469f297b3c 100644 (file)
@@ -51,8 +51,8 @@ public class StandardNodeManager<Node, Engine extends StandardNodeManagerSupport
 
     private static final Logger LOGGER = LoggerFactory.getLogger(StandardNodeManager.class);
 
-    private final Node root;
-    private final StandardRealm<Node,Engine> realm;
+    protected final Node root;
+    protected final StandardRealm<Node,Engine> realm;
 
     static final Binding NO_BINDING = new VariantBinding() {
 
@@ -116,7 +116,7 @@ public class StandardNodeManager<Node, Engine extends StandardNodeManagerSupport
 
     };
 
-    THashMap<Node, Variant> valueCache = new THashMap<>();
+    protected THashMap<Node, Variant> valueCache = new THashMap<>();
     protected THashMap<Node, THashSet<Runnable>> listeners = new THashMap<>();
 
     AtomicBoolean fireNodeListenersScheduled = new AtomicBoolean(false);
index 8551222b22d2183b866aff466a83e35a537e8dcf..3439571665f93fb302fc3993a21c88815fb18679 100644 (file)
@@ -28,6 +28,7 @@ abstract public class StandardRealm<Node, Engine extends StandardNodeManagerSupp
 
     private Engine engine;
     protected StandardNodeManager<Node, Engine> nodeManager;
+    private boolean disposed = false;
 
     private Runnable scheduleSyncExec = new Runnable() {
         @Override
@@ -178,6 +179,13 @@ abstract public class StandardRealm<Node, Engine extends StandardNodeManagerSupp
         // Clear nodeManager
         nodeManager.clear();
         nodeManager = null;
+        
+        disposed = true;
+        
+    }
+    
+    public boolean isDisposed() {
+        return disposed;
     }
 
     public StandardNodeManager<Node, Engine> getNodeManager() {