Sha256: f2cd233a6d7aa51d4e4364234e26d0b6bc01d21ea7fc8418f72e58d78ba74c59
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.5 | lib/veritas/optimizer/function/unary.rb |
veritas-optimizer-0.0.4 | lib/veritas/optimizer/function/unary.rb |