Class: RBzip2::InputData

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/rbzip2/input_data.rb

Overview

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.

Copyright © 2011, Sebastian Staudt

Constant Summary

Constants included from Constants

Constants::BASEBLOCKSIZE, Constants::CLEARMASK, Constants::DEPTH_THRESH, Constants::EOF, Constants::GREATER_ICOST, Constants::G_SIZE, Constants::INCS, Constants::LESSER_ICOST, Constants::MAX_ALPHA_SIZE, Constants::MAX_BLOCK_SIZE, Constants::MAX_CODE_LEN, Constants::MAX_SELECTORS, Constants::MIN_BLOCK_SIZE, Constants::NO_RAND_PART_A_STATE, Constants::NO_RAND_PART_B_STATE, Constants::NO_RAND_PART_C_STATE, Constants::NUM_OVERSHOOT_BYTES, Constants::N_GROUPS, Constants::N_ITERS, Constants::QSORT_STACK_SIZE, Constants::RAND_PART_A_STATE, Constants::RAND_PART_B_STATE, Constants::RAND_PART_C_STATE, Constants::RNUMS, Constants::RUNA, Constants::RUNB, Constants::SETMASK, Constants::SMALL_THRESH, Constants::START_BLOCK_STATE, Constants::WORK_FACTOR

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_size) ⇒ InputData

Returns a new instance of InputData.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rbzip2/input_data.rb', line 15

def initialize(block_size)
  @in_use = Array.new 256, false

  @seq_to_unseq = Array.new 256, 0
  @selector = Array.new MAX_SELECTORS, 0
  @selector_mtf = Array.new MAX_SELECTORS, 0

  @unzftab = Array.new 256, 0

  @base = Array.new N_GROUPS
  N_GROUPS.times { |i| @base[i] = Array.new(MAX_ALPHA_SIZE, 0) }
  @limit = Array.new N_GROUPS
  N_GROUPS.times { |i| @limit[i] = Array.new(MAX_ALPHA_SIZE, 0) }
  @perm = Array.new N_GROUPS
   N_GROUPS.times { |i| @perm[i] = Array.new(MAX_ALPHA_SIZE, 0) }
  @min_lens = Array.new N_GROUPS, 0

  @cftab = Array.new 257, 0
  @get_and_move_to_front_decode_yy = Array.new 256
  @temp_char_array_2d = Array.new N_GROUPS
  N_GROUPS.times { |i| @temp_char_array_2d[i] = Array.new(MAX_ALPHA_SIZE, 0) }
  @receive_decoding_tables_pos = Array.new N_GROUPS, 0

  @ll8 = Array.new block_size * BASEBLOCKSIZE
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def base
  @base
end

#cftabObject (readonly)

Returns the value of attribute cftab.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def cftab
  @cftab
end

#get_and_move_to_front_decode_yyObject (readonly)

Returns the value of attribute get_and_move_to_front_decode_yy.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def get_and_move_to_front_decode_yy
  @get_and_move_to_front_decode_yy
end

#in_useObject (readonly)

Returns the value of attribute in_use.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def in_use
  @in_use
end

#limitObject (readonly)

Returns the value of attribute limit.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def limit
  @limit
end

#ll8Object (readonly)

Returns the value of attribute ll8.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def ll8
  @ll8
end

#min_lensObject (readonly)

Returns the value of attribute min_lens.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def min_lens
  @min_lens
end

#permObject (readonly)

Returns the value of attribute perm.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def perm
  @perm
end

#receive_decoding_tables_posObject (readonly)

Returns the value of attribute receive_decoding_tables_pos.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def receive_decoding_tables_pos
  @receive_decoding_tables_pos
end

#selectorObject (readonly)

Returns the value of attribute selector.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def selector
  @selector
end

#selector_mtfObject (readonly)

Returns the value of attribute selector_mtf.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def selector_mtf
  @selector_mtf
end

#seq_to_unseqObject (readonly)

Returns the value of attribute seq_to_unseq.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def seq_to_unseq
  @seq_to_unseq
end

#temp_char_array_2dObject (readonly)

Returns the value of attribute temp_char_array_2d.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def temp_char_array_2d
  @temp_char_array_2d
end

#ttObject (readonly)

Returns the value of attribute tt.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def tt
  @tt
end

#unzftabObject (readonly)

Returns the value of attribute unzftab.



10
11
12
# File 'lib/rbzip2/input_data.rb', line 10

def unzftab
  @unzftab
end

Instance Method Details

#init_tt(size) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/rbzip2/input_data.rb', line 41

def init_tt(size)
  tt_shadow = @tt

  if tt_shadow.nil? || tt_shadow.size < size
    @tt = tt_shadow = Array.new(size)
  end

  tt_shadow
end