Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
de849fd0
Commit
de849fd0
authored
Feb 24, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CoreObject constructor should not accept **kw
but list all the properties instead
parent
051f1afa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
dream/simulation/BatchSource.py
dream/simulation/BatchSource.py
+2
-2
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+14
-3
dream/simulation/Source.py
dream/simulation/Source.py
+2
-2
No files found.
dream/simulation/BatchSource.py
View file @
de849fd0
...
@@ -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
...
...
dream/simulation/LineGenerationJSON.py
View file @
de849fd0
...
@@ -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'
])
...
...
dream/simulation/Source.py
View file @
de849fd0
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment