Sha256: be77dbc272574e79b33d15469e9bea4e54e7edfba9d69e9aa3891b488618b4fb

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

module Axiom
  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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 lib/axiom/optimizer/function/predicate/equality.rb
axiom-optimizer-0.1.1 lib/axiom/optimizer/function/predicate/equality.rb
axiom-optimizer-0.1.0 lib/axiom/optimizer/function/predicate/equality.rb