def left_activation(self, token, wme, binding=None): """ :type wme: WME :type token: Token :type binding: dict """ new_token = Token(token, wme, node=self, binding=binding) self.items.append(new_token)
def left_activation(self, t, w, binding=None): """ :type w: rete.WME :type t: rete.Token :type binding: dict """ new_result = Token(t, w, self, binding) owners_t = t owners_w = w for i in range(self.number_of_conditions): owners_w = owners_t.wme owners_t = owners_t.parent for token in self.ncc_node.memory: if token.parent == owners_t and token.wme == owners_w: token.ncc_results.append(new_result) new_result.owner = token Token.delete_token_and_descendants(token) self.new_result_buffer.append(new_result)
def left_activation(self, token, wme, binding=None): """ :type binding: dict :type wme: WME :type token: Token """ new_token = Token(token, wme, node=self, binding=binding) for child in self.children: child.left_activation(new_token)
def left_activation(self, t, w, binding=None): """ :type w: rete.WME :type t: rete.Token :type binding: dict """ DEBUG("NCC left-activate, wme = ", w) new_token = Token(t, w, self, binding) self.items.append(new_token) new_token.ncc_results = [] DEBUG("NCC node.items add token = ", new_token) for result in self.partner.new_result_buffer: self.partner.new_result_buffer.remove(result) result.owner = new_token new_token.ncc_results.append(result) DEBUG(" add to ncc_results: ", result) if not new_token.ncc_results: # if results == [] for child in self.children: child.left_activation(new_token, None)
def activate_from_left(self, token, wme): """ :param token: :param wme: :return: """ new_token = Token(token, wme, node=self) self.items.append(new_token) for child in self.children: child.activate_from_left(new_token)
def build_or_share_beta_memory(self, parent): """ :type parent: BetaNode :rtype: BetaMemory """ for child in parent.children: if isinstance(child, BetaMemory): return child node = BetaMemory(None, parent) # dummy top beta memory if parent == self.beta_root: node.append_token(Token(None, None)) parent.append_child(node) self.update_new_node_with_matches_from_above(node) return node
def left_activation(self, t, w, binding=None): """ :type w: rete.WME :type t: rete.Token :type binding: dict """ DEBUG("NCC partner left-activate, wme = ", w) new_result = Token(t, w, self, binding) owners_t = t owners_w = w for i in range(self.number_of_conditions): owners_w = owners_t.wme owners_t = owners_t.parent found = False for token in self.ncc_node.items: if token.parent == owners_t and token.wme == owners_w: DEBUG(" partner add to ncc_results: ", new_result) new_result.owner = token token.ncc_results.append(new_result) Token.delete_descendents_of_token(token) found = True if not found: # new_result.owner = 'buffed' self.new_result_buffer.append(new_result)
def left_activation(self, t, w, binding=None): """ :type w: rete.WME :type t: rete.Token :type binding: dict """ new_token = Token(t, w, self, binding) self._memory.append(new_token) for result in self.partner.new_result_buffer: self.partner.new_result_buffer.remove(result) new_token.ncc_results.append(result) result.owner = new_token if not new_token.ncc_results: for child in self.children: child.left_activation(new_token, None)
def left_activation(self, token, wme, binding=None): """ :type wme: rete.WME :type token: rete.Token :type binding: dict """ new_token = Token(token, wme, self, binding) self.items.append(new_token) for item in self.amem.items: if self.perform_join_test(new_token, item): jr = NegativeJoinResult(new_token, item) new_token.join_results.append(jr) item.negative_join_result.append(jr) if not new_token.join_results: for child in self.children: child.left_activation(new_token, None)