Sha256: d2d07fb13f9fcf93a786e324a3f27826f22ab3fd6f00eb45b90910e3bfae1901
Contents?: true
Size: 894 Bytes
Versions: 5
Compression:
Stored size: 894 Bytes
Contents
module Alf class Optimizer def initialize @processors = [] end def call(expr) @processors.inject(expr){|c,p| p.call(c) } end def register(processor) @processors << processor self end class Base < Algebra::Rewriter include Lang::Functional def call(expr, search = nil) return Search.new(self, search_predicate).call(expr) unless search _call(expr, search) end end class Search < Algebra::Rewriter def initialize(processor, interest) @processor = processor @interest = interest end def apply(expr) if @interest === expr @processor.call(expr, self) else super end end end # class Search end # class Optimizer end # module Alf require_relative 'optimizer/restrict' require_relative 'optimizer/project'
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.16.3 | lib/alf/optimizer.rb |
alf-core-0.16.2 | lib/alf/optimizer.rb |
alf-core-0.16.1 | lib/alf/optimizer.rb |
alf-core-0.16.0 | lib/alf/optimizer.rb |
alf-core-0.15.0 | lib/alf/optimizer.rb |