Sha256: e1966778279dc3181d7ef7374f9d9a10c6665afe130c4e631ef15e17fe749f48

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

module Veritas
  class Optimizer
    module Function
      class Predicate

        # Abstract base class representing Equality optimizations
        class Equality < self
          include Comparable

          # Optimize when the operand are a contradiction
          class Contradiction < self
            include Comparable::NeverEquivalent, Predicate::Contradiction
          end # class Contradiction

          # Optimize when the operand are a tautology
          class Tautology < self
            include Predicate::Tautology

            # Test if the operands are a tautology
            #
            # @return [Boolean]
            #
            # @api private
            def optimizable?
              left.equal?(right)
            end

          end # class Tautology

          Veritas::Function::Predicate::Equality.optimizer = chain(
            ConstantOperands,
            Contradiction,
            Tautology,
            NormalizableOperands,
            UnoptimizedOperands
          )

        end # class Equality
      end # class Predicate
    end # module Function
  end # class Optimizer
end # module Veritas

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 lib/veritas/optimizer/function/predicate/equality.rb
veritas-optimizer-0.0.6 lib/veritas/optimizer/function/predicate/equality.rb
veritas-optimizer-0.0.5 lib/veritas/optimizer/function/predicate/equality.rb
veritas-optimizer-0.0.4 lib/veritas/optimizer/function/predicate/equality.rb