public virtual void AddNode(LNNode node, int z) { if (this.Contains(node)) { return; } if (node.GetContainer() != null) { node.SetContainer(null); } node.SetContainer(this); int index = 0; bool flag = false; for (int i = 0; i < this._childCount; i++) { LNNode node2 = this.childs[i]; int zd = 0; if (node2 != null) { zd = node2.GetZOrder(); } if (zd > z) { flag = true; this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1, false); childs[index] = node; _childCount++; node.SetScreen(_screen); this.latestInserted = node; break; } index++; } if (!flag) { this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1, false); this.childs[0] = node; this._childCount++; node.SetScreen(_screen); this.latestInserted = node; } node.SetZOrder(z); node.SetParent(this); Arrays.Sort(childs, comparator); }