Class: Wongi::Engine::ProductionNode

Inherits:
BetaMemory show all
Defined in:
lib/wongi-engine/beta/production_node.rb

Instance Attribute Summary collapse

Attributes inherited from BetaNode

#children, #parent, #rete

Instance Method Summary collapse

Methods inherited from BetaMemory

#refresh_child, #seed, #subst

Methods inherited from BetaNode

#assignment_node, #delete_token, #depth, #refresh, #refresh_child, #root?

Methods included from CoreExt

included

Constructor Details

#initialize(parent, actions) ⇒ ProductionNode

Returns a new instance of ProductionNode.



9
10
11
12
# File 'lib/wongi-engine/beta/production_node.rb', line 9

def initialize parent, actions
  super(parent)
  @actions = actions.each { |action| action.production = self }
end

Instance Attribute Details

#compilation_contextObject

Returns the value of attribute compilation_context.



7
8
9
# File 'lib/wongi-engine/beta/production_node.rb', line 7

def compilation_context
  @compilation_context
end

#tracerObject

Returns the value of attribute tracer.



6
7
8
# File 'lib/wongi-engine/beta/production_node.rb', line 6

def tracer
  @tracer
end

Instance Method Details

#beta_activate(token) ⇒ Object



14
15
16
17
18
19
# File 'lib/wongi-engine/beta/production_node.rb', line 14

def beta_activate token
  return unless super
  @actions.each do |action|
    action.execute token if action.respond_to? :execute
  end
end

#beta_deactivate(token) ⇒ Object



21
22
23
24
25
26
# File 'lib/wongi-engine/beta/production_node.rb', line 21

def beta_deactivate token
  return unless super
  @actions.each do |action|
    action.deexecute token if action.respond_to? :deexecute
  end
end