Sha256: 678b9245048a1d91e53c9a618382ccbaa0d66befc0cd67469bb3512c6c076215
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
module Veritas class Optimizer module Logic class Predicate # Abstract base class representing LessThan optimizations class LessThan < self include Comparable # Optimize when the operands are always false class AlwaysFalse < self include Predicate::AlwaysFalse # Test if the operands are always false # # @return [Boolean] # # @api private def optimizable? left.equal?(right) || LessThanOrEqualTo::AlwaysFalse.new(operation).optimizable? end end # class AlwaysFalse # Optimize when the operands are always true class AlwaysTrue < self include Predicate::AlwaysTrue # Test if the operands are always true # # @return [Boolean] # # @api private def optimizable? operation.class.call(Predicate::Util.max(left), Predicate::Util.min(right)) end end # class AlwaysTrue Veritas::Logic::Predicate::LessThan.optimizer = chain( ConstantOperands, AlwaysFalse, AlwaysTrue, NormalizableOperands ) end # class LessThan end # class Predicate end # module Logic end # class Optimizer end # module Veritas
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.2 | lib/veritas/optimizer/logic/predicate/less_than.rb |
veritas-0.0.1 | lib/veritas/optimizer/logic/predicate/less_than.rb |