-
assigned issue to
- marked as major
When changing the NodeType of a node in a ProbNet, the method getNode(NodeType) does not return the correct nodes
Issue #192
resolved
When in a ProbNet a node is changed its NodeType, e.g., if we change the NodeType to a node of type DECISION,
probNet.getNode(node.getName()).setNodeType(NodeType.CHANCE);
In the probNet variable, the node appears with its new type, but if the following code is executed
List<Node> decisionNodes = probNet.getNodes(NodeType.DECISION);
in the list shows up the node that previously was a DECISION and now is of CHANCE type.
It seems that the NodeTypeDepot class is not updating the nodesHashMaps variable accordingly.
Comments (2)
-
-
reporter - changed status to resolved
In the Node class, the method setNodeType was changing the attribute nodeType, but the nodeDepot attribute of the ProbNet class was not being informed of the change. The method has been updated to do so:
public void setNodeType(NodeType nodeType) { // Remove node from NodeTypeDepot HashMap this.probNet.nodeDepot.removeNode(this); // Change of nodeType this.nodeType = nodeType; // Add node to NodeTypeDepot HashMap this.probNet.nodeDepot.addNode(this); }
- Log in to comment