public void Travers_first(ITreeTraversCallback icallback) { if (this.root != null) { this.root.Travers_first(icallback); } }
public void Travers_level(ITreeTraversCallback iCallback) { if (this.queue == null) { this.queue = new Queue <BEquip_node>(); } if (this.root != null) { this.queue.Enqueue(this.root); } while (this.queue.Count > 0) { BEquip_node bEquip_node = this.queue.Dequeue(); if (iCallback == null || iCallback.TraversCallback(bEquip_node, bEquip_node.Level)) { int childrenNum = bEquip_node.GetChildrenNum(); for (int i = 0; i < childrenNum; i++) { BEquip_node childByIndex = bEquip_node.GetChildByIndex(i); if (childByIndex != null) { this.queue.Enqueue(childByIndex); } } } } }
public void Travers_first(ITreeTraversCallback iCallbck) { if (iCallbck == null || iCallbck.TraversCallback(this, this._level)) { int num = (this.children == null) ? 0 : this.children.Count; for (int i = 0; i < num; i++) { if (this.children[i] != null) { this.children[i].Travers_first(iCallbck); } } } }