Class: Wongi::Engine::FilterNode
- Defined in:
- lib/wongi-engine/beta/filter_node.rb
Instance Attribute Summary collapse
-
#test ⇒ Object
Returns the value of attribute test.
Attributes inherited from BetaNode
Instance Method Summary collapse
- #beta_activate(token, wme = nil, assignments = { }) ⇒ Object
- #equivalent?(test) ⇒ Boolean
-
#initialize(parent, test) ⇒ FilterNode
constructor
A new instance of FilterNode.
- #refresh_child(child) ⇒ Object
Methods inherited from BetaNode
#assignment_node, #beta_memory, #delete_token, #depth, #filter_node, #join_node, #ncc_node, #neg_node, #network, #optional_node, #refresh
Methods included from CoreExt
Constructor Details
#initialize(parent, test) ⇒ FilterNode
Returns a new instance of FilterNode.
8 9 10 11 |
# File 'lib/wongi-engine/beta/filter_node.rb', line 8 def initialize parent, test super parent self.test = test end |
Instance Attribute Details
#test ⇒ Object
Returns the value of attribute test.
6 7 8 |
# File 'lib/wongi-engine/beta/filter_node.rb', line 6 def test @test end |
Instance Method Details
#beta_activate(token, wme = nil, assignments = { }) ⇒ Object
13 14 15 16 17 |
# File 'lib/wongi-engine/beta/filter_node.rb', line 13 def beta_activate token, wme = nil, assignments = { } if test.passes? token propagate_activation token, nil, {} end end |
#equivalent?(test) ⇒ Boolean
19 20 21 |
# File 'lib/wongi-engine/beta/filter_node.rb', line 19 def equivalent? test test == self.test end |
#refresh_child(child) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/wongi-engine/beta/filter_node.rb', line 23 def refresh_child child tmp = children self.children = [ child ] parent.tokens.each do |token| beta_activate token end self.children = tmp end |