class Axiom::Optimizer::Function::Connective::Binary
Abstract base class representing Binary
connective optimizations
Private Instance Methods
Test if the left and right predicates match against constant values
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 52 def constant_value? util = Util util.constant?(left.right) && util.constant?(right.right) end
Test if the left and right
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 138 def contradiction? left.respond_to?(:inverse) && right.respond_to?(:inverse) && left.inverse.eql?(right) end
Test if the operands are equality/inclusion predicates for the same attribute
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 19 def equality_with_same_attributes? left_equality? && right_equality? && same_attribute? && constant_value? end
Test if the operands are inequality/exclusion predicates for the same attribute
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 31 def inequality_with_same_attributes? left_inequality? && right_inequality? && same_attribute? && constant_value? end
Test if the left is a contradiction
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 120 def left_contradiction? left.equal?(Axiom::Function::Proposition::Contradiction.instance) end
Test if the left is an equality or inclusion
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 62 def left_equality? util = Axiom::Function::Predicate left.kind_of?(util::Equality) || left.kind_of?(util::Inclusion) end
Test if the left is an inequality or exclusion
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 82 def left_inequality? util = Axiom::Function::Predicate left.kind_of?(util::Inequality) || left.kind_of?(util::Exclusion) end
Test if the left is a tautology
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 102 def left_tautology? left.equal?(Axiom::Function::Proposition::Tautology.instance) end
Merge the right enumerables from the operands
@return [Array]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 149 def merged_right_enumerables [left.right, right.right].flatten end
Test if the right is a contradiction
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 129 def right_contradiction? right.equal?(Axiom::Function::Proposition::Contradiction.instance) end
Test if the right is an equality or inclusion
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 72 def right_equality? util = Axiom::Function::Predicate right.kind_of?(util::Equality) || right.kind_of?(util::Inclusion) end
Test if the right is an inequality or exclusion
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 92 def right_inequality? util = Axiom::Function::Predicate right.kind_of?(util::Inequality) || right.kind_of?(util::Exclusion) end
Test if the right is a tautology
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 111 def right_tautology? right.equal?(Axiom::Function::Proposition::Tautology.instance) end
Test if the left and right predicates are for the same attribute
@return [Boolean]
@api private
# File lib/axiom/optimizer/function/connective/binary.rb, line 43 def same_attribute? left.left.equal?(right.left) end