class Axiom::Optimizer::Algebra::Restriction

Abstract base class representing Restriction optimizations

Attributes

predicate[R]

The optimized predicate

@return [Function]

@api private

Public Class Methods

new(*) click to toggle source

Initialize an Restriction optimizer

@return [undefined]

@api private

Calls superclass method
# File lib/axiom/optimizer/algebra/restriction.rb, line 23
def initialize(*)
  super
  @predicate = Function.optimize_operand(operation.predicate)
end

Private Instance Methods

constant_false_predicate?() click to toggle source

Return true if the predicate is not callable, and not a true value

In the system anything not a Tautology or true is false.

@return [Boolean]

@api private

# File lib/axiom/optimizer/algebra/restriction.rb, line 55
def constant_false_predicate?
  ! (predicate.respond_to?(:call) || constant_true_predicate?)
end
constant_true_predicate?() click to toggle source

Return true if the predicate is a true value

@return [Boolean]

@api private

# File lib/axiom/optimizer/algebra/restriction.rb, line 44
def constant_true_predicate?
  predicate.equal?(true)
end
wrap_operand(operand = operand.operand) click to toggle source

Wrap the operand’s operand in a Restriction

@return [Restriction]

@api private

# File lib/axiom/optimizer/algebra/restriction.rb, line 35
def wrap_operand(operand = operand.operand)
  operand.restrict(predicate)
end