public BevNode addChild(BevNode node) { if (_children == null) _children = new List<BevNode>(); if (_children.Count == MAX_CHILDREN) throw new Exception(this + "overflow, max children number is " + MAX_CHILDREN); _children.Add(node); node._parent = this; return this; }
public BevNode addChild(BevNode node) { if (_children == null) { _children = new List <BevNode>(); } if (_children.Count == MAX_CHILDREN) { throw new Exception(this + "overflow, max children number is " + MAX_CHILDREN); } _children.Add(node); node._parent = this; return(this); }
public BevNode AddChildAt(BevNode node, int index) { this.addChild(node); if (index < 0) index = 0; else if (index > _children.Count - 1) index = _children.Count; for (int i = _children.Count - 1; i > index; --i) { _children[i] = _children[i-1]; } _children[index] = node; return this; }
public BevNode AddChildAt(BevNode node, int index) { this.addChild(node); if (index < 0) { index = 0; } else if (index > _children.Count - 1) { index = _children.Count; } for (int i = _children.Count - 1; i > index; --i) { _children[i] = _children[i - 1]; } _children[index] = node; return(this); }