public object Clone() { Node res = new Node(); res.name = (string)this.name.Clone(); res.type = (string)this.type.Clone(); res.isVirtual = this.isVirtual; res.loopCount = this.loopCount; res.finishCondition = this.finishCondition; if (this.precondition != null) { res.precondition = (Precondition)this.precondition.Clone(); } if (this.child != null) { List<Node> childs = new List<Node>(); foreach (var children in this.child) { childs.Add((Node)children.Clone()); } res.child = childs; } return res; }
private bool isHasTreeNode(List<Node> nodes, Node node) { if (node != null && nodes != null && nodes.Count > 0) { foreach (var item in nodes) { if (item == node) { return true; } else { if (item.child != null && item.child.Count > 0) { return this.isHasTreeNode(item.child, node); } } } } return false; }
public TreeMemento(Node state) { this.state = state; }