Class: Omnizip::Algorithms::PPMdBase
- Inherits:
-
Omnizip::Algorithm
- Object
- Omnizip::Algorithm
- Omnizip::Algorithms::PPMdBase
- Includes:
- BaseConstants
- Defined in:
- lib/omnizip/algorithms/ppmd_base.rb
Overview
Base class for PPMd (Prediction by Partial Matching) algorithms
This abstract base class provides common functionality for PPMd variants (PPMd7, PPMd8, etc.) while allowing each variant to implement its specific features.
The design follows the Template Method pattern, where common operations are defined here and variant-specific operations are delegated to subclasses.
Direct Known Subclasses
Defined Under Namespace
Modules: BaseConstants
Constant Summary
Constants included from BaseConstants
BaseConstants::ALPHABET_SIZE, BaseConstants::BOT_VALUE, BaseConstants::DEFAULT_MEM_SIZE, BaseConstants::DEFAULT_ORDER, BaseConstants::MAX_MEM_SIZE, BaseConstants::MAX_ORDER, BaseConstants::MIN_MEM_SIZE, BaseConstants::MIN_ORDER, BaseConstants::TOP_VALUE
Instance Attribute Summary
Attributes inherited from Omnizip::Algorithm
Instance Method Summary collapse
-
#compress(input, output, options = {}) ⇒ void
Compress data using PPMd variant.
-
#decompress(input, output, options = {}) ⇒ void
Decompress data using PPMd variant.
Methods inherited from Omnizip::Algorithm
compress, decompress, inherited, #initialize, metadata, #with_filter
Constructor Details
This class inherits a constructor from Omnizip::Algorithm
Instance Method Details
#compress(input, output, options = {}) ⇒ void
This method returns an undefined value.
Compress data using PPMd variant
65 66 67 68 69 70 71 |
# File 'lib/omnizip/algorithms/ppmd_base.rb', line 65 def compress(input, output, = {}) input = prepare_input(input) output = prepare_output(output) encoder = create_encoder(output, ) encoder.encode_stream(input) end |
#decompress(input, output, options = {}) ⇒ void
This method returns an undefined value.
Decompress data using PPMd variant
79 80 81 82 83 84 85 86 87 |
# File 'lib/omnizip/algorithms/ppmd_base.rb', line 79 def decompress(input, output, = {}) input = prepare_input(input) output = prepare_output(output) decoder = create_decoder(input, ) result = decoder.decode_stream output.write(result) end |