Class: Resedit::Huffman::Balancer

Inherits:
Object
  • Object
show all
Defined in:
lib/resedit/text/huffman.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#huffObject (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

#balanceTreeObject



58
59
60
# File 'lib/resedit/text/huffman.rb', line 58

def balanceTree()
    raise "Not implemented."
end

#balanceValuesObject



55
56
# File 'lib/resedit/text/huffman.rb', line 55

def balanceValues()
end