Class: Wongi::Engine::AlphaMemory
- Inherits:
-
Object
- Object
- Wongi::Engine::AlphaMemory
- Defined in:
- lib/wongi-engine/alpha_memory.rb
Instance Attribute Summary collapse
-
#betas ⇒ Object
readonly
Returns the value of attribute betas.
-
#rete ⇒ Object
readonly
Returns the value of attribute rete.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #activate(wme) ⇒ Object
- #deactivate(wme) ⇒ Object
-
#initialize(template, rete) ⇒ AlphaMemory
constructor
A new instance of AlphaMemory.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(template, rete) ⇒ AlphaMemory
Returns a new instance of AlphaMemory.
5 6 7 8 9 10 |
# File 'lib/wongi-engine/alpha_memory.rb', line 5 def initialize(template, rete) @template = template @rete = rete @betas = [] @frozen = false end |
Instance Attribute Details
#betas ⇒ Object (readonly)
Returns the value of attribute betas.
3 4 5 |
# File 'lib/wongi-engine/alpha_memory.rb', line 3 def betas @betas end |
#rete ⇒ Object (readonly)
Returns the value of attribute rete.
3 4 5 |
# File 'lib/wongi-engine/alpha_memory.rb', line 3 def rete @rete end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
3 4 5 |
# File 'lib/wongi-engine/alpha_memory.rb', line 3 def template @template end |
Instance Method Details
#activate(wme) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/wongi-engine/alpha_memory.rb', line 12 def activate(wme) # TODO: it used to activate before adding to the list. mandated by the original thesis. investigate. it appears to create duplicate tokens - needs a remedy in collecting nodes betas.each do |beta| beta.alpha_activate wme end end |
#deactivate(wme) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/wongi-engine/alpha_memory.rb', line 19 def deactivate(wme) # p deactivate: {wme:} betas.each do |beta| beta.alpha_deactivate wme end end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/wongi-engine/alpha_memory.rb', line 26 def inspect "<Alpha #{__id__} template=#{template}>" end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/wongi-engine/alpha_memory.rb', line 30 def to_s inspect end |