Class RubyTorrent::Covering
In: lib/rubytorrent/package.rb
Parent: Object

a Covering is a set of non-overlapping ranges within a given start point and endpoint.

Methods

==   complete!   complete?   empty!   empty?   fill   first_gap   new   poke  

Attributes

domain  [RW] 
ranges  [RW] 

Public Class methods

‘domain’ should be an AwesomeRange determining the start and end point. ‘ranges’ should be an array of non-overlapping AwesomeRanges sorted by start point.

Public Instance methods

given a covering of size N and a new range ‘r’, returns a covering of size 0 < s <= N + 1 that also covers the range ‘r’.

given an array of non-overlapping ranges sorted by start point, and a range ‘domain’, returns the first range from ‘domain’ not covered by any range in the array.

given a covering of size N and a new range ‘r’, returns a covering of size 0 <= s <= N + 1 that doesn‘t cover the range given by ‘r’.

[Validate]