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-1.1.1-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.1.0-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.0.3-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.0.2-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.0.1-java lib/pacer/pipe/expandable_pipe.rb
pacer-1.0.0-java lib/pacer/pipe/expandable_pipe.rb