Beispiel #1
0
        /// <summary>Balance the tree for best search performance</summary>
        public virtual void Balance()
        {
            // System.out.print("Before root splitchar = "); System.out.println(sc[root]);
            int i = 0;
            int n = length;

            String[]            k    = new String[n];
            char[]              v    = new char[n];
            TernaryTreeIterator iter = new TernaryTreeIterator(this);

            while (iter.MoveNext())
            {
                v[i]   = iter.GetValue();
                k[i++] = (String)iter.Current;
            }
            Init();
            InsertBalanced(k, v, 0, n);
        }
 public Item(TernaryTreeIterator _enclosing, TernaryTreeIterator.Item i)
 {
     this._enclosing = _enclosing;
     this.parent     = i.parent;
     this.child      = i.child;
 }
 /// <summary>Construct item.</summary>
 /// <param name="p">a char</param>
 /// <param name="c">a char</param>
 public Item(TernaryTreeIterator _enclosing, char p, char c)
 {
     this._enclosing = _enclosing;
     this.parent     = p;
     this.child      = c;
 }
 /// <summary>default constructor</summary>
 public Item(TernaryTreeIterator _enclosing)
 {
     this._enclosing = _enclosing;
     this.parent     = (char)0;
     this.child      = (char)0;
 }