Beispiel #1
0
        public static DoubleArrayTrie Build(List <string> surfaces, bool compact)
        {
            var trie = new Trie.Trie();

            foreach (var surface in surfaces)
            {
                trie.Add(surface);
            }
            var doubleArrayTrie = new DoubleArrayTrie(compact);

            doubleArrayTrie.Build(trie);

            return(doubleArrayTrie);
        }
 public String BuildTree()
 {
     ramCounter = new PerformanceCounter("Memory", "Available MBytes");
     try
     {
         using (StreamReader sr = new StreamReader(path))
         {
             string cur;
             Double availableRam = ramCounter.NextValue();
             while (((cur = sr.ReadLine()) != null) && (availableRam > 40))
             {
                 dict.Add(cur.ToLower());
                 availableRam = ramCounter.NextValue();
             }
             Debug.WriteLine("Tree has maxed out its RAM capacity...");
             return("Memory has been maxed out to its capacity");
         }
     }
     catch (IOException)
     {
         Debug.WriteLine("File could be used by another process");
         return("Failed...");
     }
 }