Clear() 공개 메소드

public Clear ( ) : void
리턴 void
예제 #1
0
 protected void Add(int symbol)
 {
     var coderstream = new BitStream32 ();
     coderstream.Clear ();
     this.Coder.Encode(coderstream, symbol);
     var ctx = new BitStreamCtx (0);
     // this.CoderStream.Seek (0);
     int numbits = (int)coderstream.CountBits;
     var node = this.Root;
     for (int b = 0; b < numbits; b++) {
         var bitcode = coderstream.Read (ctx);
         (node.B as FakeBitmap).Write (bitcode);
         if (bitcode) {
             if (numbits == b + 1) {
                 if (node.Right == null) {
                     var leaf = new WaveletLeaf (node, symbol);
                     // this.Alphabet.Add (leaf);
                     this.Alphabet [symbol] = leaf;
                     node.Right = leaf;
                 } else {
                     (node.Right as WaveletLeaf).Increment ();
                 }
             } else {
                 if (node.Right == null) {
                     node.Right = new WaveletInner (node, true);
                 }
                 node = node.Right as WaveletInner;
             }
         } else {
             if (numbits == b + 1) {
                 if (node.Left == null) {
                     var leaf = new WaveletLeaf (node, symbol);
                     // this.Alphabet.Add (leaf);
                     this.Alphabet [symbol] = leaf;
                     node.Left = leaf;
                 } else {
                     (node.Left as WaveletLeaf).Increment ();
                 }
             } else {
                 if (node.Left == null) {
                     node.Left = new WaveletInner (node, true);
                 }
                 node = node.Left as WaveletInner;
             }
         }
     }
 }