Sha256: 12b6a1455f06d38e61bd1d737a7b12dfa1ee009875388e1bc8ae013d6511b899

Contents?: true

Size: 1.14 KB

Versions: 37

Compression:

Stored size: 1.14 KB

Contents

module Pacer::Pipes
  class UnaryTransformPipe < RubyPipe
    import com.tinkerpop.pipes.Pipe
    import com.tinkerpop.pipes.util.iterators.SingleIterator

    attr_reader :branch_a, :method

    def initialize(method, branch_a)
      super()
      if branch_a.is_a? Pipe
        @branch_a = branch_a
        @a = nil
      else
        @a = branch_a
      end
      @first = true
      @method = method
      @element = nil
    end

    def processNextStart
      next_a
      a.send method rescue nil if a.respond_to? method
    end

    protected

    attr_accessor :element, :a

    def next_element
      @first = false
      self.element = starts.next
    end

    def next_a
      if branch_a
        begin
          self.a = branch_a.next
        rescue EmptyPipe
          next_element
          branch_a.setStarts SingleIterator.new(element) if branch_a
          retry
        rescue NativeException => e
          if @first
            next_element
            branch_a.setStarts SingleIterator.new(element) if branch_a
            retry
          else
            raise e
          end
        end
      else
        next_element
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

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