Class: Omnizip::Algorithms::LZMA::Match
- Inherits:
-
Object
- Object
- Omnizip::Algorithms::LZMA::Match
- Defined in:
- lib/omnizip/algorithms/lzma/match.rb
Overview
Match candidate result from LZ77 match finding
Instance Attribute Summary collapse
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
Instance Method Summary collapse
-
#initialize(distance, length) ⇒ Match
constructor
A new instance of Match.
-
#to_s ⇒ String
String representation for debugging.
-
#valid?(dict_size) ⇒ Boolean
Check if match is valid for given dictionary size.
Constructor Details
#initialize(distance, length) ⇒ Match
Returns a new instance of Match.
10 11 12 13 |
# File 'lib/omnizip/algorithms/lzma/match.rb', line 10 def initialize(distance, length) @distance = distance @length = length end |
Instance Attribute Details
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
8 9 10 |
# File 'lib/omnizip/algorithms/lzma/match.rb', line 8 def distance @distance end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
8 9 10 |
# File 'lib/omnizip/algorithms/lzma/match.rb', line 8 def length @length end |
Instance Method Details
#to_s ⇒ String
String representation for debugging
26 27 28 |
# File 'lib/omnizip/algorithms/lzma/match.rb', line 26 def to_s "Match(dist=#{@distance}, len=#{@length})" end |
#valid?(dict_size) ⇒ Boolean
Check if match is valid for given dictionary size
19 20 21 |
# File 'lib/omnizip/algorithms/lzma/match.rb', line 19 def valid?(dict_size) @distance <= dict_size && @length >= 2 end |