Class: Omnizip::Formats::Rar::Compression::LZ77Huffman::HuffmanBuilder::Node
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rar::Compression::LZ77Huffman::HuffmanBuilder::Node
- Defined in:
- lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb
Overview
Tree node for Huffman tree construction
Instance Attribute Summary collapse
-
#frequency ⇒ Object
Returns the value of attribute frequency.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(symbol, frequency) ⇒ Node
constructor
A new instance of Node.
- #leaf? ⇒ Boolean
Constructor Details
#initialize(symbol, frequency) ⇒ Node
Returns a new instance of Node.
26 27 28 29 30 31 |
# File 'lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb', line 26 def initialize(symbol, frequency) @symbol = symbol @frequency = frequency @left = nil @right = nil end |
Instance Attribute Details
#frequency ⇒ Object
Returns the value of attribute frequency.
24 25 26 |
# File 'lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb', line 24 def frequency @frequency end |
#left ⇒ Object
Returns the value of attribute left.
24 25 26 |
# File 'lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb', line 24 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
24 25 26 |
# File 'lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb', line 24 def right @right end |
#symbol ⇒ Object
Returns the value of attribute symbol.
24 25 26 |
# File 'lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb', line 24 def symbol @symbol end |
Instance Method Details
#leaf? ⇒ Boolean
33 34 35 |
# File 'lib/omnizip/formats/rar/compression/lz77_huffman/huffman_builder.rb', line 33 def leaf? @left.nil? && @right.nil? end |