Sha256: c19e09dc7dbce4b622a0e7b4ec56846624a0135eca089dcdfbccc362c9680bf0

Contents?: true

Size: 957 Bytes

Versions: 37

Compression:

Stored size: 957 Bytes

Contents

module Pacer::Pipes
  class CrossProductTransformPipe < UnaryTransformPipe
    attr_reader :branch_b

    def initialize(method, branch_a, branch_b)
      super(method, branch_a)
      if branch_b.is_a? Pipe
        @branch_b = branch_b
        @b = nil
      else
        @b = branch_b
      end
    end

    def processNextStart
      next_pair
      a.send method, b rescue nil if a.respond_to? method
    end

    protected

    attr_accessor :b

    def next_pair
      if branch_b
        begin
          self.b = branch_b.next
        rescue Pacer::EmptyPipe, java.util.NoSuchElementException
          next_a
          branch_b.setStarts SingleIterator.new(element)
          retry
        rescue NativeException => e
          if @first
            next_a
            branch_b.setStarts SingleIterator.new(element)
            retry
          else
            raise e
          end
        end
      else
        next_a
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
pacer-2.0.24-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.22-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.20-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.19-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.18-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.17-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.16-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.15-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.14-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.13-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.12-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.10-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.10.pre-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.8-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.6-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.4.pre-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-2.0.0.pre-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-1.6.0-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-1.5.4-java lib/pacer/pipe/cross_product_transform_pipe.rb
pacer-1.5.3-java lib/pacer/pipe/cross_product_transform_pipe.rb