The MultiTrie is a Trie of Tries.

It stores words and their associated patch commands. The MultiTrie handles patch commands broken into their constituent parts, as a MultiTrie does, but the commands are delimited by the skip command.

Inheritance: MultiTrie
Ejemplo n.º 1
0
        /// <summary>
        /// Remove empty rows from the given Trie and return the newly reduced Trie.
        /// </summary>
        /// <param name="by">the <see cref="Trie"/> to reduce</param>
        /// <returns>the newly reduced Trie</returns>
        public override Trie Reduce(Reduce by)
        {
            List <Trie> h = new List <Trie>();

            foreach (Trie trie in m_tries)
            {
                h.Add(trie.Reduce(by));
            }

            MultiTrie2 m = new MultiTrie2(forward);

            m.m_tries = h;
            return(m);
        }
Ejemplo n.º 2
0
        public void TestMultiTrie2()
        {
            Trie t = new MultiTrie2(true);

            string[] keys = { "a", "ba", "bb", "c" };
            /*
             * short vals won't work, see line 155 for example
             * the IOOBE is caught (wierd), but shouldnt affect patch cmds?
             */
            string[] vals = { "1111", "2222", "2223", "4444" };

            for (int i = 0; i < keys.Length; i++)
            {
                t.Add(keys[i], vals[i]);
            }

            AssertTrieContents(t, keys, vals);
        }
Ejemplo n.º 3
0
        public void TestMultiTrie2Backwards()
        {
            Trie t = new MultiTrie2(false);

            string[] keys = { "a", "ba", "bb", "c" };

            /*
             * short vals won't work, see line 155 for example
             * the IOOBE is caught (wierd), but shouldnt affect patch cmds?
             */
            string[] vals = { "1111", "2222", "2223", "4444" };

            for (int i = 0; i < keys.Length; i++)
            {
                t.Add(keys[i], vals[i]);
            }

            AssertTrieContents(t, keys, vals);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Remove empty rows from the given Trie and return the newly reduced Trie.
        /// </summary>
        /// <param name="by">the <see cref="Trie"/> to reduce</param>
        /// <returns>the newly reduced Trie</returns>
        public override Trie Reduce(Reduce by)
        {
            List<Trie> h = new List<Trie>();
            foreach (Trie trie in tries)
                h.Add(trie.Reduce(by));

            MultiTrie2 m = new MultiTrie2(forward);
            m.tries = h;
            return m;
        }