Sha256: bec8147318ea37e0b1b2bd131bd53c0e3d6deb0b145b90effdb9eac49c932a33
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
# encoding: utf-8 module Axiom class Optimizer module Function module Connective # Abstract base class representing Negation optimizations class Negation < Optimizer include Unary # Optimize when the operand can be inverted class InvertibleOperand < self # Test if the operand can be inverted # # @return [Boolean] # # @api private def optimizable? operand.respond_to?(:inverse) end # A Negation of an Function is equivalent to the inverted Function # # @return [Function] # # @api private def optimize operand.inverse end end # class InvertibleOperand # Optimize when the operand is constant class ConstantOperand < self include Unary::ConstantOperand # A Negation with constant values is equivalent to a Proposition # # @return [Proposition] # # @api private def optimize Axiom::Function::Proposition.new(super) end end # class ConstantOperand # Optimize when the operand is unoptimized class UnoptimizedOperand < self include Function::Unary::UnoptimizedOperand end # class UnoptimizedOperand Axiom::Function::Connective::Negation.optimizer = chain( ConstantOperand, InvertibleOperand, UnoptimizedOperand ) end # class Negation end # module Connective end # module Function end # class Optimizer end # module Axiom
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
axiom-optimizer-0.1.1 | lib/axiom/optimizer/function/connective/negation.rb |
axiom-optimizer-0.1.0 | lib/axiom/optimizer/function/connective/negation.rb |