/// <summary> /// Returns the cumulative counter position object of a child node with all counter values. /// </summary> /// <param name="node">The node.</param> /// <returns></returns> public ITreeTableCounter GetCounterPositionOfChild(ITreeTableNode node) { ITreeTableCounter pos = GetCounterPosition(); if (Object.ReferenceEquals(node, Right)) { return(pos.Combine(GetLeftC().GetCounterTotal(), TreeTableCounterCookies.CountAll)); } else if (Object.ReferenceEquals(node, Left)) { return(pos); } throw new ArgumentException("must be a child node", "node"); }
/// <summary> /// Returns the total of this node's counter and child nodes (cached). /// </summary> public ITreeTableCounter GetCounterTotal() { if (Tree.IsInitializing) { return(null); } else if (_counter == null) { ITreeTableCounter left = GetLeftC().GetCounterTotal(); ITreeTableCounter right = GetRightC().GetCounterTotal(); if (left != null && right != null) { _counter = left.Combine(right, TreeTableCounterCookies.CountAll); } } return(_counter); }