public static MultipleNode deepCopy(MultipleNode other) { MultipleNode res = new MultipleNode(other._value); res._color = other._color; switch (other._children._children[0]) { case OperatorNode op: res.addChild(OperatorNode.deepCopy(op)); break; case ConstNode cn: res.addChild(ConstNode.deepCopy(cn)); break; case VariableNode vn: res.addChild(VariableNode.deepCopy(vn)); break; case MultipleNode mn: res.addChild(MultipleNode.deepCopy(mn)); break; default: break; } return(res); }
public static OperatorNode deepCopy(OperatorNode other) { OperatorNode res = new OperatorNode(other._operatorType, other._childNum); res._color = other._color; for (int i = 0; i < res._childNum; i++) { switch (other._children._children[i]) { case OperatorNode op: res.addChild(OperatorNode.deepCopy(op)); break; case ConstNode cn: res.addChild(ConstNode.deepCopy(cn)); break; case VariableNode vn: res.addChild(VariableNode.deepCopy(vn)); break; case MultipleNode mn: res.addChild(MultipleNode.deepCopy(mn)); break; default: break; } } return(res); }
public static GeneticTree deepCopy(GeneticTree other) { GeneticTree res = new GeneticTree(other._maxDepth, other._maxBranching); res._nodesColor = other._nodesColor; res._id = other._id; res._nodeIndices = new List <string>(other._nodeIndices); switch (other._root) { case OperatorNode on: res._root = OperatorNode.deepCopy((OperatorNode)other._root); break; case VariableNode vn: res._root = VariableNode.deepCopy((VariableNode)other._root); break; case ConstNode cn: res._root = ConstNode.deepCopy((ConstNode)other._root); break; case MultipleNode mn: res._root = MultipleNode.deepCopy((MultipleNode)other._root); break; default: break; } res.getRPN(); res._nodeStatsDictionary = other._nodeStatsDictionary; res._firstParentId = other._firstParentId; res._secondParentId = other._secondParentId; //res.setColor(other._nodesColor.r, other._nodesColor.g, other._nodesColor.b); return(res); }