public static SuffixTreeDiagnostic create(ISuffixTree suffixTree) { if (suffixTree != null) { var diag = new SuffixTreeDiagnostic() { Tree = suffixTree }; diag.build(suffixTree.Root); return(diag); } else { throw new ArgumentNullException("tree"); } }
private static void CreateSuffixTree(string text, TraceLevel traceLevel) { if (string.IsNullOrEmpty(text) || text.Length <= 1) { throw new ArgumentException("text cannot be null, empty, or have a length less than 1"); } Stopwatch stopWatch = new Stopwatch(); Console.Write("."); if (traceLevel >= TraceLevel.Lite) { Debug.WriteLine(""); Debug.WriteLine(""); Debug.WriteLine(""); Debug.WriteLine("================================================================================================= "); Debug.WriteLine(text); Debug.WriteLine(""); Debug.WriteLine("text length: {0}", text.Length); } else if (traceLevel >= TraceLevel.BuildTime) { Debug.WriteLine("================================================================================================= "); Debug.WriteLine(""); Debug.WriteLine("text length: {0}", text.Length); } stopWatch.Start(); var suffixTree = SuffixTree.Create <SortedList>(text); stopWatch.Stop(); if (traceLevel >= TraceLevel.BuildTime) { Debug.WriteLine("total milliseconds: {0}", stopWatch.ElapsedMilliseconds); Debug.WriteLine(""); } // diagnose.. var diag = SuffixTreeDiagnostic.create(suffixTree); diag.display(traceLevel); }
public static SuffixTreeDiagnostic create(ISuffixTree suffixTree) { if (suffixTree != null) { var diag = new SuffixTreeDiagnostic() { Tree = suffixTree }; diag.build(suffixTree.Root); return diag; } else throw new ArgumentNullException("tree"); }