Class: Veritas::Optimizer::Function::Connective::Negation::InvertibleOperand

Inherits:
Veritas::Optimizer::Function::Connective::Negation show all
Defined in:
lib/veritas/optimizer/function/connective/negation.rb

Overview

Optimize when the operand can be inverted

Constant Summary

Constants inherited from Veritas::Optimizer

Noop, VERSION

Instance Attribute Summary

Attributes included from Unary

#operand

Attributes inherited from Veritas::Optimizer

#operation

Instance Method Summary collapse

Methods included from Unary

#initialize

Methods inherited from Veritas::Optimizer

chain, #initialize

Instance Method Details

#optimizable?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if the operand can be inverted



20
21
22
# File 'lib/veritas/optimizer/function/connective/negation.rb', line 20

def optimizable?
  operand.respond_to?(:inverse)
end

#optimizeFunction

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A Negation of an Function is equivalent to the inverted Function



29
30
31
# File 'lib/veritas/optimizer/function/connective/negation.rb', line 29

def optimize
  operand.inverse
end