Sha256: 7b11562d005f1d9c35e3ede15e5cfb3d763a58cc58d19f30524f7fb4c7fc1e57

Contents?: true

Size: 858 Bytes

Versions: 22

Compression:

Stored size: 858 Bytes

Contents

module Pacer::Pipes
  class PropertyComparisonFilterPipe < RubyPipe
    def initialize(left, right, filter)
      super()
      @filter = filter
      @left = left.to_s
      @right = right.to_s
    end

    protected

    def processNextStart
      while true
        obj = @starts.next
        l = obj.getProperty(@left)
        r = obj.getProperty(@right)
        case @filter
        when Compare::EQUAL
          return obj if l == r
        when Compare::NOT_EQUAL
          return obj if l != r
        when Compare::GREATER_THAN
          return obj if l and r and l > r
        when Compare::LESS_THAN
          return obj if l and r and l < r
        when Compare::GREATER_THAN_EQUAL
          return obj if l and r and l >= r
        when Compare::LESS_THAN_EQUAL
          return obj if l and r and l <= r
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pacer-1.5.2-java lib/pacer/pipe/property_comparison_pipe.rb
pacer-1.5.1-java lib/pacer/pipe/property_comparison_pipe.rb