natix.CompactDS.WaveletTree.Build C# (CSharp) Method

Build() public method

public Build ( IList text, int alphabet_size, IIEncoder32 coder = null ) : void
text IList
alphabet_size int
coder IIEncoder32
return void
        public void Build(IList<int> text, int alphabet_size, IIEncoder32 coder = null)
        {
            this.Alphabet = new WT_Leaf[alphabet_size];
            this.Root = new WT_Inner (null, true);
            if (coder == null) {
                coder = new BinaryCoding(ListIFS.GetNumBits(alphabet_size-1));
            }
            this.Coder = coder;
            for (int i = 0; i < text.Count; i++) {
                this.Add (text [i]);
            }
            this.FinishBuild (this.Root);
        }

Usage Example

Ejemplo n.º 1
0
        public static SequenceBuilder GetWT(
			BitmapFromBitStream bitmap_builder = null,
			Func<int, IIEncoder32> get_coder = null
		)
        {
            if (bitmap_builder == null) {
                bitmap_builder = BitmapBuilders.GetGGMN_wt(16);
            }
            return delegate (IList<int> seq, int sigma) {
                var wt = new WaveletTree ();
                wt.BitmapBuilder = bitmap_builder;
                // var enc = new BinaryCoding (numbits);
                IIEncoder32 enc;
                if (get_coder == null) {
                    int numbits = (int)Math.Ceiling (Math.Log (sigma, 2));
                    enc = new BinaryCoding (numbits);
                } else {
                    enc = get_coder(sigma);
                }
                wt.Build (seq, sigma, enc);
                return wt;
            };
        }
All Usage Examples Of natix.CompactDS.WaveletTree::Build