private void UpdateLockedParent(int value) { BinaryLockableNode <ValueType> currentNode = Parent; while (null != currentNode) { currentNode.LockedDescendantsCount += value; currentNode = currentNode.Parent; } }
private bool AreAncestorsLocked() { BinaryLockableNode <ValueType> currentNode = this; while (null != currentNode.Parent) { if (currentNode.Parent.IsLocked) { return(true); } currentNode = currentNode.Parent; } return(false); }
public BinaryLockableNode(ValueType value, BinaryLockableNode <ValueType> leftChild, BinaryLockableNode <ValueType> rightChild) { Value = value; if (null != leftChild) { leftChild.Parent = this; } if (null != rightChild) { rightChild.Parent = this; } Left = leftChild; Right = rightChild; Parent = null; IsLocked = false; LockedDescendantsCount = 0; }
public BinaryLockableNode(ValueType value, BinaryLockableNode <ValueType> leftChild = null) : this(value, leftChild, null) { }