Sha256: d47f59517c298141396e7e42e3677b4b5105095f0a5dab1156c8fd6084a8a538
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 KB
Contents
# encoding: utf-8 module Veritas class Optimizer module Function # Mixin for optimizations to Unary functions module Unary # The optimized operand # # @return [Relation] # # @api private attr_reader :operand # Initialize a Unary optimizer # # @return [undefined] # # @api private def initialize(*) super @operand = optimize_operand end private # Optimize the operand # # @return [Relation] # # @api private def optimize_operand Function.optimize_operand(operation.operand) end # Optimize when the operand is constant module ConstantOperand # Test if the operand is constant # # @return [Boolean] # # @api private def optimizable? Util.constant?(operand) end # Evaluate the operand and return the constant # # @return [Object] # # @api private def optimize operation.class.call(operand) end end # module ConstantOperand # Optimize when the operand is unoptimized module UnoptimizedOperand # Test if the operand is unoptimized # # @return [Boolean] # # @api private def optimizable? ! operand.equal?(operation.operand) end # Return a Aggregate with an optimized operand # # @return [Aggregate] # # @api private def optimize operation.class.new(operand) end end # module UnoptimizedOperand end # class Unary end # module Function end # class Optimizer end # module Veritas
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
veritas-optimizer-0.0.7 | lib/veritas/optimizer/function/unary.rb |
veritas-optimizer-0.0.6 | lib/veritas/optimizer/function/unary.rb |