def local_init(bucket_count, bucket_width, start_priority)
      @width = bucket_width
      old = @buckets
      @buckets = if @cached_buckets == nil
        Array.new(bucket_count) { [] }
      else
        n = @cached_buckets.size
        if bucket_count < n
          # shrink the array
          @cached_buckets.slice!(bucket_count, n)
        else
          # expand the array
          @cached_buckets.fill(n, bucket_count - n) { [] }
        end
        @cached_buckets
      end
      @cached_buckets = old

      @last_priority = start_priority
      i = start_priority / bucket_width # virtual bucket
      @last_bucket = (i % bucket_count).to_i
      @bucket_top = (i+1) * bucket_width + 0.5 * bucket_width

      # set up queue size change thresholds
      @shrink_threshold = bucket_count / 2 - 2
      @expand_threshold = 2 * bucket_count
    end
def local_init(bucket_count, bucket_width, start_priority)
      @width = bucket_width
      old = @buckets
      @buckets = if @cached_buckets == nil
        Array.new(bucket_count) { [] }
      else
        n = @cached_buckets.size
        if bucket_count < n
          # shrink the array
          @cached_buckets.slice!(bucket_count, n)
        else
          # expand the array
          @cached_buckets.fill(n, bucket_count - n) { [] }
        end
        @cached_buckets
      end
      @cached_buckets = old

      @last_priority = start_priority
      i = start_priority / bucket_width # virtual bucket
      @last_bucket = (i % bucket_count).to_i
      @bucket_top = (i+1) * bucket_width + 0.5 * bucket_width

      # set up queue size change thresholds
      @shrink_threshold = bucket_count / 2 - 2
      @expand_threshold = 2 * bucket_count
    end
Initializes a bucket array within