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
class BatchSource(Source):
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,
interarrivalTime=interarrivalTime, entity=entity, **kw)
interarrivalTime=interarrivalTime, entity=entity)
self.numberOfUnits = batchNumberOfUnits
......
......@@ -190,8 +190,11 @@ def createObjects():
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 = element.copy()
for k in ('element_id', 'top', 'left'):
element.pop(k, None)
# 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
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'
......@@ -218,9 +221,12 @@ def createObjects():
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
# element itself
element = element.copy()
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
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':
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'
......@@ -243,8 +249,13 @@ def createObjects():
# read the data and create them
# -----------------------------------------------------------------------
for (element_id, element) in nodes.iteritems():
element = element.copy()
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':
S=Source(**element)
S.nextIds=getSuccessorList(element['id'])
......
......@@ -34,8 +34,8 @@ import Globals
#============================================================================
# The Source object is a Process
#============================================================================
class Source(CoreObject):
def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part', **kw):
class Source(CoreObject):
def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part'):
# Default values
if not interarrivalTime:
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