Class: OMF::Rete::Planner::FilterPlan
- Inherits:
-
Object
- Object
- OMF::Rete::Planner::FilterPlan
- Defined in:
- lib/omf_rete/planner/filter_plan.rb
Overview
This class represents a filter operation on a binding stream.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
-
#initialize(projectPattern, outDescription = nil, &block) ⇒ FilterPlan
constructor
resultSet - set of bindings provided by this source.
- #materialize(description, source, opts) ⇒ Object
Constructor Details
#initialize(projectPattern, outDescription = nil, &block) ⇒ FilterPlan
resultSet - set of bindings provided by this source
18 19 20 21 22 |
# File 'lib/omf_rete/planner/filter_plan.rb', line 18 def initialize(projectPattern, outDescription = nil, &block) @projectPattern = projectPattern @description = outDescription #|| projectPattern.sort @block = block end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
13 14 15 |
# File 'lib/omf_rete/planner/filter_plan.rb', line 13 def description @description end |
Instance Method Details
#materialize(description, source, opts) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/omf_rete/planner/filter_plan.rb', line 25 def materialize(description, source, opts) # A filter has the same in as well as out description as it doesn't change # the tuple just potentially drop it. # pts = FilterTupleStream.new(@projectPattern, description, &@block) pts.source = source # if (in_description == @projectPattern) # pts.on_add &@block # else # projectIndex = @projectPattern.collect do |bname| # pts.index_for_binding(bname) # end # pts.on_add do |*t| # pt = projectIndex.collect do |index| # t[index] # end # @block.call(*pt) # end # end pts end |