Class: Wongi::Engine::NccPartner
- Defined in:
- lib/wongi-engine/beta/ncc_partner.rb
Instance Attribute Summary collapse
-
#divergent ⇒ Object
Returns the value of attribute divergent.
-
#ncc ⇒ Object
attr_accessor :conjuncts.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Attributes inherited from BetaNode
Instance Method Summary collapse
- #beta_activate(token) ⇒ Object
- #delete_token(token) ⇒ Object
-
#initialize(parent) ⇒ NccPartner
constructor
A new instance of NccPartner.
Methods inherited from BetaNode
#assignment_node, #beta_memory, #depth, #filter_node, #join_node, #ncc_node, #neg_node, #network, #optional_node, #refresh, #refresh_child
Methods included from CoreExt
Constructor Details
#initialize(parent) ⇒ NccPartner
Returns a new instance of NccPartner.
10 11 12 13 14 |
# File 'lib/wongi-engine/beta/ncc_partner.rb', line 10 def initialize parent super # @conjuncts = 0 @tokens = [] end |
Instance Attribute Details
#divergent ⇒ Object
Returns the value of attribute divergent.
8 9 10 |
# File 'lib/wongi-engine/beta/ncc_partner.rb', line 8 def divergent @divergent end |
#ncc ⇒ Object
attr_accessor :conjuncts
7 8 9 |
# File 'lib/wongi-engine/beta/ncc_partner.rb', line 7 def ncc @ncc end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
5 6 7 |
# File 'lib/wongi-engine/beta/ncc_partner.rb', line 5 def tokens @tokens end |
Instance Method Details
#beta_activate(token) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/wongi-engine/beta/ncc_partner.rb', line 16 def beta_activate token t = Token.new token, nil, {} t.node = self owner = ncc.tokens.find do |ncc_token| ncc_token.parent.node == divergent end if owner owner.ncc_results << t t.owner = owner owner.delete_children else tokens << t end end |
#delete_token(token) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/wongi-engine/beta/ncc_partner.rb', line 31 def delete_token token token.owner.ncc_results.delete token if token.owner.ncc_results.empty? ncc.children.each do |node| node.beta_activate token.owner, nil, {} end end end |