Class: BentleyMcIlroy::BlockFingerprintTable
- Inherits:
-
Object
- Object
- BentleyMcIlroy::BlockFingerprintTable
- Defined in:
- lib/bentley_mcilroy.rb
Overview
Look-up table with a #find method which finds an appropriate block and then modifies the match to extend it to more characters.
Instance Method Summary collapse
- #find_for_compress(fingerprint, block_size, target, position) ⇒ Object
- #find_for_diff(fingerprint, block_size, target) ⇒ Object
-
#initialize(block_sequenced_text) ⇒ BlockFingerprintTable
constructor
A new instance of BlockFingerprintTable.
Constructor Details
#initialize(block_sequenced_text) ⇒ BlockFingerprintTable
Returns a new instance of BlockFingerprintTable.
39 40 41 42 43 44 45 46 |
# File 'lib/bentley_mcilroy.rb', line 39 def initialize(block_sequenced_text) @blocked_text = block_sequenced_text @hash = {} @blocked_text.blocks.each do |block| (@hash[block.hash] ||= []) << block end end |
Instance Method Details
#find_for_compress(fingerprint, block_size, target, position) ⇒ Object
48 49 50 51 |
# File 'lib/bentley_mcilroy.rb', line 48 def find_for_compress(fingerprint, block_size, target, position) source = @blocked_text.text find(fingerprint, block_size, source, target, position) end |
#find_for_diff(fingerprint, block_size, target) ⇒ Object
53 54 55 56 |
# File 'lib/bentley_mcilroy.rb', line 53 def find_for_diff(fingerprint, block_size, target) source = @blocked_text.text find(fingerprint, block_size, source, target) end |