Sha256: 83d155678543f5eeed1cdb8260b760e8e8afeb88e3ca2dde7a29c36b7cacd27c

Contents?: true

Size: 759 Bytes

Versions: 18

Compression:

Stored size: 759 Bytes

Contents

module Groonga
  module ExpressionTree
    class LogicalOperation
      attr_reader :operator
      attr_reader :nodes
      def initialize(operator, nodes)
        @operator = operator
        @nodes = nodes
      end

      def build(expression)
        @nodes.each_with_index do |node, i|
          node.build(expression)
          expression.append_operator(@operator, 2) if i > 0
        end
      end

      def estimate_size(table)
        estimated_sizes = @nodes.collect do |node|
          node.estimate_size(table)
        end
        case @operator
        when Operator::AND
          estimated_sizes.min
        when Operator::OR
          estimated_sizes.max
        else
          estimated_sizes.first
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rroonga-7.1.1-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-7.1.1-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-7.0.2-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-7.0.2-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.1.3-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.1.3-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.1.0-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.1.0-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.9-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.9-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.7-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.7-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.5-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.5-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.4-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.4-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.2-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb
rroonga-6.0.2-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_tree/logical_operation.rb