Sha256: 4c1c0e5d3a3a85672ad0ef1d1db1960d886f0ed45031a81c5acfa5f1ab125f2c

Contents?: true

Size: 969 Bytes

Versions: 26

Compression:

Stored size: 969 Bytes

Contents

module Pacer::Pipes
  class ExpandablePipe < RubyPipe
    def initialize
      super()
      @queue = java.util.LinkedList.new
    end

    def add(element, metadata = nil, path = nil)
      @queue.add [element, metadata, path]
    end

    def metadata
      @metadata
    end

    def next
      super
    ensure
      @path = @next_path
      @metadata = @next_metadata
    end

    protected

    def processNextStart
      if @queue.isEmpty
        @next_metadata = nil
        r = @starts.next
        if pathEnabled and @starts.respond_to? :getCurrentPath
          @next_path = @starts.getCurrentPath
        else
          @next_path = java.util.ArrayList.new
        end
        r
      else
        element, @next_metadata, @next_path = @queue.remove
        element
      end
    end

    def getPathToHere
      path = java.util.ArrayList.new
      if @path
        @path.each do |e|
          path.add e
        end
      end
      path
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
pacer-2.0.10-java lib/pacer/pipe/expandable_pipe.rb
pacer-2.0.10.pre-java lib/pacer/pipe/expandable_pipe.rb
pacer-2.0.8-java lib/pacer/pipe/expandable_pipe.rb
pacer-2.0.6-java lib/pacer/pipe/expandable_pipe.rb
pacer-2.0.4.pre-java lib/pacer/pipe/expandable_pipe.rb
pacer-2.0.0.pre-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.6.0-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.5.4-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.5.3-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.5.2-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.5.1-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.4.2-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.4.1-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.4.0-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.3.5-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.3.4-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.3.3-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.3.2-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.3.1-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.2.0-java lib/pacer/pipe/expandable_pipe.rb