Sha256: 8a0eae19124ee0edcbbbff8ce68bc91feff347e070dd5d16aa50e8ad8a5608cd
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
module Veritas class Optimizer module Logic class Predicate # Abstract base class representing GreaterThan optimizations class GreaterThan < 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) || GreaterThanOrEqualTo::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.min(left), Predicate::Util.max(right)) end end # class AlwaysTrue Veritas::Logic::Predicate::GreaterThan.optimizer = chain( ConstantOperands, AlwaysFalse, AlwaysTrue, NormalizableOperands ) end # class GreaterThan 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/greater_than.rb |
veritas-0.0.1 | lib/veritas/optimizer/logic/predicate/greater_than.rb |