Skip to content

Commit

Permalink
UpdateMessage object
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsekar committed Nov 14, 2017
1 parent 1e084d7 commit 98d4651
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions wc_rules/sim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
from obj_model import core
from wc_rules.base import BaseClass
from wc_rules.query import NodeTypeQuery, NodeQuery, GraphQuery
from collections import deque

class UpdateMessage(dict):
def __init__(self,*args,**kwargs):
validkeys = 'update_attr instance nodequery graphquery'.split()
for kwarg in kwargs:
if kwarg not in validkeys:
raise KeyError(kwarg+' not a valid key.')
remaining_keys = set(validkeys) - set(kwargs.keys())
for kwarg in remaining_keys:
kwargs[kwarg] = None
super().__init__(*args,**kwargs)

class SimulationState(core.Model):
agents = core.OneToManyAttribute(BaseClass,related_name='ss_agent')
Expand All @@ -11,6 +23,7 @@ class SimulationState(core.Model):
def __init__(self,**kwargs):
super().__init__(**kwargs)
self.nodetypequery= NodeTypeQuery()
self.update_message_queue = deque()

def add_nodequery(self,nq):
self.nodequeries.append(nq)
Expand Down

0 comments on commit 98d4651

Please sign in to comment.