public ParentNode(int countArrInNode, ParNode prevNode = null) { this._prevParNode = prevNode; this._countArrInNode = countArrInNode; if (prevNode != null) { InitParent(countArrInNode, prevNode); } else { InitIfPrevNodeIsNull(countArrInNode); } }
private void InitParent(int countArrInNode, ParNode prevNode) { CollectionParents = _prevParNode.Parent.CollectionParents ?? new List <int> { Seek }; if (_prevParNode.CountArrInNode < _countArrInNode) { CollectionParents.Add(_prevParNode.NodeId); } if (_prevParNode.CountArrInNode > _countArrInNode) { var range = GetRange(); CollectionParents.RemoveRange(range.Item1, range.Item2); } this.CurrentParentNode = CollectionParents[CollectionParents.Count - 1]; }
public ParNode(string key, ParNode prevNode = null) { if (prevNode == null) { InitIfPrevNodeIsNull(key); } else { this.PrevNodeId = prevNode.PrevNodeId; this.NodeId = prevNode.NextNodeId; this.NextNodeId = NodeId + 1; this._key = key.Remove(key.LastIndexOf(".")); this.Number = this._key; this.CountArrInNode = key.Split('.').Length; this.Parent = new ParentNode(this.CountArrInNode, prevNode); } }