Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsekar committed Oct 16, 2018
1 parent df92314 commit e311b7a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wc_rules/rete_nodes.py
@@ -1,4 +1,5 @@
from .utils import generate_id
from .rete_token import Token,TokenRegister

class ReteNode(object):
def __init__(self,id=None):
Expand All @@ -8,7 +9,7 @@ def __init__(self,id=None):
self.predecessors = set()
self.successors = set()

def receive_token(self,token):
def receive_token(self,token,sender):
# logic for receiving tokens
# subsequent calls to process_token and send_token
tokens = self.process_token(token)
Expand All @@ -18,8 +19,8 @@ def receive_token(self,token):

def send_token(self,token):
# logic for sending token to successors
for node_id in self.successors:
self.matcher().get_rete_node(node_id).receive_token(token)
for node in self.successors:
node.receive_token(token,self)
return

def process_token(self,token):
Expand Down Expand Up @@ -74,6 +75,7 @@ def __str__(self):
class store(SingleInputNode):
def __init__(self,id=None):
super().__init__(id)
self._register = TokenRegister()

def __str__(self):
return 'store'
Expand All @@ -99,6 +101,7 @@ class merge(ReteNode):
def __init__(self,var_tuple,id=None):
super().__init__(id)
self.variable_names = var_tuple
self._register = TokenRegister()

def __str__(self):
return ','.join(self.variable_names)

0 comments on commit e311b7a

Please sign in to comment.