internal void Remove(string segment) { Fx.Assert(null != segment, ""); TrieSegment trieSegment = this[segment]; if (null == trieSegment) { return; } if (trieSegment.HasChildren) { trieSegment.Data = null; return; } if (trieSegment == this.root) { // Remove the entire tree! this.root = null; this.hasDescendants = false; return; } trieSegment.Remove(); this.PruneRoot(); }
internal void Remove(string segment) { TrieSegment segment2 = this[segment]; if (segment2 != null) { if (segment2.HasChildren) { segment2.Data = null; } else if (segment2 == this.root) { this.root = null; this.hasDescendants = false; } else { segment2.Remove(); this.PruneRoot(); } } }