TrimToSize() public method

public TrimToSize ( ) : void
return void
示例#1
0
        /**
         * Each node stores a character (splitchar) which is part of
         * some Key(s). In a compressed branch (one that only contain
         * a single string key) the trailer of the key which is not
         * already in nodes is stored  externally in the kv array.
         * As items are inserted, key substrings decrease.
         * Some substrings may completely  disappear when the whole
         * branch is totally decompressed.
         * The tree is traversed to find the key substrings actually
         * used. In addition, duplicate substrings are removed using
         * a map (implemented with a TernaryTree!).
         *
         */
        virtual public void TrimToSize()
        {
            // first balance the tree for best performance
            Balance();

            // redimension the node arrays
            RedimNodeArrays(freenode);

            // ok, compact kv array
            CharVector kx = new CharVector();

            kx.Alloc(1);
            TernaryTree map = new TernaryTree();

            Compact(kx, map, root);
            kv = kx;
            kv.TrimToSize();
        }
示例#2
0
        /// <summary>
        /// Each node stores a character (splitchar) which is part of
        /// some Key(s). In a compressed branch (one that only contain
        /// a single string key) the trailer of the key which is not
        /// already in nodes is stored  externally in the kv array.
        /// As items are inserted, key substrings decrease.
        /// Some substrings may completely  disappear when the whole
        /// branch is totally decompressed.
        /// The tree is traversed to find the key substrings actually
        /// used. In addition, duplicate substrings are removed using
        /// a map (implemented with a TernaryTree!).
        /// </summary>
        public void TrimToSize()
        {
            // first balance the tree for best performance
            Balance();

            // redimension the node arrays
            redimNodeArrays(Freenode);

            // ok, compact kv array
            var kx = new CharVector();

            kx.Alloc(1);
            var map = new TernaryTree();

            compact(kx, map, Root);
            Kv = kx;
            Kv.TrimToSize();
        }
示例#3
0
        /**
         * Each node stores a character (splitchar) which is part of
         * some Key(s). In a compressed branch (one that only contain
         * a single string key) the trailer of the key which is not
         * already in nodes is stored  externally in the kv array.
         * As items are inserted, key substrings decrease.
         * Some substrings may completely  disappear when the whole
         * branch is totally decompressed.
         * The tree is traversed to find the key substrings actually
         * used. In addition, duplicate substrings are removed using
         * a map (implemented with a TernaryTree!).
         *
         */
        virtual public void TrimToSize() {
            // first balance the tree for best performance
            Balance();

            // redimension the node arrays
            RedimNodeArrays(freenode);

            // ok, compact kv array
            CharVector kx = new CharVector();
            kx.Alloc(1);
            TernaryTree map = new TernaryTree();
            Compact(kx, map, root);
            kv = kx;
            kv.TrimToSize();
        }