Sha256: b42a5ebc676243fda713bfdcad9397efbf7e8251a2826b294a385dce2c244a19

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

module Pacer::Pipes
  class MapPipe < AbstractPipe
    field_reader :starts

    def initialize(back, block)
      super()
      @block = block
      @back = back
      @graph = back.graph if back
      @extensions = back.extensions + [Pacer::Extensions::BlockFilterElement]
      @is_element = @graph.element_type?(back.element_type) if @graph
    end

    def processNextStart
      while true
        obj = starts.next
        begin
          if @is_element
            obj = obj.add_extensions(@extensions)
            obj.back = @back
            obj.graph = @back.graph
          end
        rescue
        end
        result = @block.call(obj)
        return result
      end
    rescue NativeException => e
      if e.cause.getClass == Pacer::NoSuchElementException.getClass
        raise e.cause
      else
        raise e
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacer-0.9.1.1-java lib/pacer/pipe/map_pipe.rb