Class: Omnizip::Algorithms::PPMd8::RestorationMethod
- Inherits:
-
Object
- Object
- Omnizip::Algorithms::PPMd8::RestorationMethod
- Includes:
- Constants
- Defined in:
- lib/omnizip/algorithms/ppmd8/restoration_method.rb
Overview
Strategy pattern for PPMd8 restoration methods
PPMd8 supports multiple restoration methods that determine how the model handles memory management and context updating when memory is exhausted.
Constant Summary
Constants included from Constants
Constants::BIN_SCALE, Constants::DEFAULT_RESTORE_METHOD, Constants::GLUE_COUNT_THRESHOLD, Constants::INIT_ESCAPE_FREQ, Constants::INTERVAL, Constants::INT_BITS, Constants::MAX_FREQ, Constants::MAX_STATES, Constants::PERIOD_BITS, Constants::PROB_TOTAL, Constants::RESTORE_METHOD_CUT_OFF, Constants::RESTORE_METHOD_RESTART, Constants::SEE_CONTEXTS, Constants::SUFFIX_CONTEXTS, Constants::UNIT_ALLOC_SIZE, Constants::UNIT_SIZE
Instance Attribute Summary collapse
-
#method_type ⇒ Object
readonly
Returns the value of attribute method_type.
Instance Method Summary collapse
-
#initialize(method_type = RESTORE_METHOD_RESTART) ⇒ RestorationMethod
constructor
Initialize restoration method.
-
#restore(model) ⇒ void
Execute restoration based on the selected method.
Constructor Details
#initialize(method_type = RESTORE_METHOD_RESTART) ⇒ RestorationMethod
Initialize restoration method
39 40 41 |
# File 'lib/omnizip/algorithms/ppmd8/restoration_method.rb', line 39 def initialize(method_type = RESTORE_METHOD_RESTART) @method_type = method_type end |
Instance Attribute Details
#method_type ⇒ Object (readonly)
Returns the value of attribute method_type.
34 35 36 |
# File 'lib/omnizip/algorithms/ppmd8/restoration_method.rb', line 34 def method_type @method_type end |
Instance Method Details
#restore(model) ⇒ void
This method returns an undefined value.
Execute restoration based on the selected method
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/omnizip/algorithms/ppmd8/restoration_method.rb', line 47 def restore(model) case @method_type when RESTORE_METHOD_RESTART restart_restoration(model) when RESTORE_METHOD_CUT_OFF cut_off_restoration(model) else raise ArgumentError, "Unknown restoration method: #{@method_type}" end end |