Class: Resedit::Huffman::Balancer
- Inherits:
-
Object
- Object
- Resedit::Huffman::Balancer
- Defined in:
- lib/resedit/text/huffman.rb
Instance Attribute Summary collapse
-
#huff ⇒ Object
readonly
Returns the value of attribute huff.
Instance Method Summary collapse
- #addData(bytes) ⇒ Object
- #balanceTree ⇒ Object
- #balanceValues ⇒ Object
-
#initialize(huff) ⇒ Balancer
constructor
A new instance of Balancer.
Constructor Details
#initialize(huff) ⇒ Balancer
Returns a new instance of Balancer.
43 44 45 46 |
# File 'lib/resedit/text/huffman.rb', line 43 def initialize(huff) @huff = huff @tbl = {} end |
Instance Attribute Details
#huff ⇒ Object (readonly)
Returns the value of attribute huff.
42 43 44 |
# File 'lib/resedit/text/huffman.rb', line 42 def huff @huff end |
Instance Method Details
#addData(bytes) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/resedit/text/huffman.rb', line 48 def addData(bytes) bytes.each_byte{|b| @tbl[b] = 0 if !@tbl[b] @tbl[b] += 1 } end |
#balanceTree ⇒ Object
58 59 60 |
# File 'lib/resedit/text/huffman.rb', line 58 def balanceTree() raise "Not implemented." end |
#balanceValues ⇒ Object
55 56 |
# File 'lib/resedit/text/huffman.rb', line 55 def balanceValues() end |