Class: Wongi::Engine::FilterNode
Instance Attribute Summary collapse
Attributes inherited from BetaNode
#children, #parent, #rete
Instance Method Summary
collapse
Methods inherited from BetaNode
#assignment_node, #depth, #refresh, #root?
Methods included from CoreExt
included
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) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/wongi-engine/beta/filter_node.rb', line 13
def beta_activate token
if test.passes? token
children.each do |child|
child.beta_activate Token.new( child, token, nil, {} )
end
end
end
|
#beta_deactivate(token) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/wongi-engine/beta/filter_node.rb', line 21
def beta_deactivate token
children.each do |child|
child.tokens.each do |t|
if t.parent == token
child.beta_deactivate t
end
end
end
end
|
#equivalent?(test) ⇒ Boolean
32
33
34
|
# File 'lib/wongi-engine/beta/filter_node.rb', line 32
def equivalent? test
test == self.test
end
|
#refresh_child(child) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/wongi-engine/beta/filter_node.rb', line 36
def refresh_child child
tmp = children
self.children = [ child ]
parent.tokens.each do |token|
beta_activate token
end
self.children = tmp
end
|