static SuffixTreeNode BuildCore(SuffixGroup group, int index) { if (group.Size == 1) { return(new SuffixTreeNode(index, true)); } SuffixTreeNode node = new SuffixTreeNode(-1, false); foreach (SuffixGroup subGroup in group.BuildGroups()) { string prefix; SuffixGroup reducedGroup = subGroup.Reduce(out prefix); node.AddChild(prefix, BuildCore(reducedGroup, index - prefix.Length)); } return(node); }
public override bool Equals(object obj) { SuffixGroup other = obj as SuffixGroup; return(other != null && Enumerable.SequenceEqual(suffixes, other.suffixes)); }