Commit de849fd0 authored by Jérome Perrin's avatar Jérome Perrin

CoreObject constructor should not accept **kw

but list all the properties instead
parent 051f1afa
...@@ -31,9 +31,9 @@ from RandomNumberGenerator import RandomNumberGenerator ...@@ -31,9 +31,9 @@ from RandomNumberGenerator import RandomNumberGenerator
class BatchSource(Source): class BatchSource(Source):
def __init__(self, id, name, interarrivalTime=None, def __init__(self, id, name, interarrivalTime=None,
entity='Dream.Batch', batchNumberOfUnits=1, **kw): entity='Dream.Batch', batchNumberOfUnits=1):
Source.__init__(self, id=id, name=name, Source.__init__(self, id=id, name=name,
interarrivalTime=interarrivalTime, entity=entity, **kw) interarrivalTime=interarrivalTime, entity=entity)
self.numberOfUnits = batchNumberOfUnits self.numberOfUnits = batchNumberOfUnits
......
...@@ -190,8 +190,11 @@ def createObjects(): ...@@ -190,8 +190,11 @@ def createObjects():
for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes
element['id'] = element_id # create a new entry for the element (dictionary) element['id'] = element_id # create a new entry for the element (dictionary)
element = element.copy()
for k in ('element_id', 'top', 'left'):
element.pop(k, None)
# with key 'id' and value the the element_id # with key 'id' and value the the element_id
resourceClass = element.get('_class', 'not found') # get the class type of the element resourceClass = element.pop('_class') # get the class type of the element
if resourceClass=='Dream.Repairman': # check the object type if resourceClass=='Dream.Repairman': # check the object type
id = element.get('id', 'not found') # get the id of the element id = element.get('id', 'not found') # get the id of the element
name = element.get('name', id) # get the name of the element / default 'not_found' name = element.get('name', id) # get the name of the element / default 'not_found'
...@@ -218,9 +221,12 @@ def createObjects(): ...@@ -218,9 +221,12 @@ def createObjects():
for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes
# the key is the element_id and the second is the # the key is the element_id and the second is the
# element itself # element itself
element = element.copy()
element['id'] = element_id # create a new entry for the element (dictionary) element['id'] = element_id # create a new entry for the element (dictionary)
for k in ('element_id', 'top', 'left'):
element.pop(k, None)
# with key 'id' and value the the element_id # with key 'id' and value the the element_id
resourceClass = element.get('_class', 'not found') # get the class type of the element resourceClass = element.pop('_class') # get the class type of the element
if resourceClass=='Dream.OperatorPool': if resourceClass=='Dream.OperatorPool':
id = element.get('id', 'not found') # get the id of the element / default 'not_found' id = element.get('id', 'not found') # get the id of the element / default 'not_found'
name = element.get('name', 'not found') # get the name of the element / default 'not_found' name = element.get('name', 'not found') # get the name of the element / default 'not_found'
...@@ -243,8 +249,13 @@ def createObjects(): ...@@ -243,8 +249,13 @@ def createObjects():
# read the data and create them # read the data and create them
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
for (element_id, element) in nodes.iteritems(): for (element_id, element) in nodes.iteritems():
element = element.copy()
element['id'] = element_id element['id'] = element_id
objClass=element.get('_class', 'not found') # XXX not sure about top & left.
for k in ('element_id', 'top', 'left'):
element.pop(k, None)
objClass = element.pop('_class')
if objClass=='Dream.Source': if objClass=='Dream.Source':
S=Source(**element) S=Source(**element)
S.nextIds=getSuccessorList(element['id']) S.nextIds=getSuccessorList(element['id'])
......
...@@ -35,7 +35,7 @@ import Globals ...@@ -35,7 +35,7 @@ import Globals
# The Source object is a Process # The Source object is a Process
#============================================================================ #============================================================================
class Source(CoreObject): class Source(CoreObject):
def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part', **kw): def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part'):
# Default values # Default values
if not interarrivalTime: if not interarrivalTime:
interarrivalTime = {'distributionType': 'Fixed', 'mean': 1} interarrivalTime = {'distributionType': 'Fixed', 'mean': 1}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment