コード例 #1
0
    def delete(self, notifierRemoval=None, notifierUnlinking=None):
        """
        Remove the alpha-memory from the network
        """

        # before to call the Node.delete,
        # references to this alpha-memory
        # have to be removed
        # from all wme object
        # but wme.delete()
        # isn't called because a-memory
        # delete doens't mean fact retract
        for wme in self.items:
            wme.unlinkAlphaMemory(self)

        # before call the Node.delete,
        # manually remove the parent's reference
        # to this node (because alpha memory is in
        # parent.memory slot, not in children

        if not self.isRightRoot():
            if callable(notifierUnlinking):
                notifierUnlinking(self.rightParent, self)

            self.rightParent.memory = None
            if self.rightParent.isLeaf():
                self.rightParent.delete(notifierRemoval, notifierUnlinking)
            self.rightParent = None

        Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #2
0
ファイル: AlphaMemory.py プロジェクト: ximarx/myclips
 def delete(self, notifierRemoval=None, notifierUnlinking=None):
     """
     Remove the alpha-memory from the network
     """
     
     # before to call the Node.delete,
     # references to this alpha-memory 
     # have to be removed
     # from all wme object
     # but wme.delete()
     # isn't called because a-memory
     # delete doens't mean fact retract
     for wme in self.items:
         wme.unlinkAlphaMemory(self)
         
         
     # before call the Node.delete,
     # manually remove the parent's reference
     # to this node (because alpha memory is in
     # parent.memory slot, not in children
     
     if not self.isRightRoot():
         if callable(notifierUnlinking):
             notifierUnlinking(self.rightParent, self)
         
         self.rightParent.memory = None
         if self.rightParent.isLeaf():
             self.rightParent.delete(notifierRemoval, notifierUnlinking)
         self.rightParent = None
     
     Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #3
0
ファイル: BetaMemory.py プロジェクト: julianpistorius/myclips
 def delete(self, notifierRemoval=None, notifierUnlinking=None):
     """
     Remove the beta-memory from the network
     """
     # first delete all tokens
     Memory.delete(self)
         
     # then i can call parent destructor
     Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #4
0
ファイル: PNode.py プロジェクト: stefano-bragaglia/myclips
 def delete(self, notifierRemoval=None, notifierUnlinking=None):
     if self.isMain:
         for linkedNode in self._linkedPNodes:
             linkedNode.delete(notifierRemoval, notifierUnlinking)
             
         self._linkedPNodes = []
         
     Memory.delete(self)
     Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #5
0
    def delete(self, notifierRemoval=None, notifierUnlinking=None):
        """
        Remove the beta-memory from the network
        """
        # first delete all tokens
        Memory.delete(self)

        # then i can call parent destructor
        Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #6
0
ファイル: NccNode.py プロジェクト: julianpistorius/myclips
 def delete(self, notifierRemoval=None, notifierUnlinking=None):
     """
     Remove this node and the partner from the network
     """
     # notify unlink between ncc and partner
     #EventManager.trigger(EventManager.E_NODE_UNLINKED, self.get_partner(), self)
     # then destroy the partner
     self.partner.delete(notifierRemoval, notifierUnlinking)
     # and last destroy this node itself
     Memory.delete(self)
     Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #7
0
 def delete(self, notifierRemoval=None, notifierUnlinking=None):
     """
     Remove this node and the partner from the network
     """
     # notify unlink between ncc and partner
     #EventManager.trigger(EventManager.E_NODE_UNLINKED, self.get_partner(), self)
     # then destroy the partner
     self.partner.delete(notifierRemoval, notifierUnlinking)
     # and last destroy this node itself
     Memory.delete(self)
     Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #8
0
    def delete(self, notifierRemoval=None, notifierUnlinking=None):
        """
        Delete all token in the results buffer
        and then remove the node from the network.
        """
        while len(self._buffer) > 0:
            # i use the pop:
            # token doesn't have
            # link to results buffer
            # so i must force the ref removal
            # from it
            self._buffer.pop().delete()

        Node.delete(self, notifierRemoval, notifierUnlinking)
コード例 #9
0
 def delete(self, notifierRemoval=None, notifierUnlinking=None):
     """
     Delete all token in the results buffer
     and then remove the node from the network.
     """
     while len(self._buffer) > 0:
         # i use the pop:
         # token doesn't have
         # link to results buffer
         # so i must force the ref removal
         # from it
         self._buffer.pop().delete()
         
     Node.delete(self, notifierRemoval, notifierUnlinking)