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
cb1fc027
Commit
cb1fc027
authored
Sep 20, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Sep 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QueueLIFO code enhance for future demonstration of extensibility ideas
parent
2e97a98e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
7 deletions
+25
-7
dream/simulation/JSONInputs/Topology01.json
dream/simulation/JSONInputs/Topology01.json
+1
-1
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+11
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+3
-2
dream/simulation/QueueLIFO.py
dream/simulation/QueueLIFO.py
+10
-4
No files found.
dream/simulation/JSONInputs/Topology01.json
View file @
cb1fc027
...
...
@@ -52,7 +52,7 @@
},
"successorList"
:
[
"E1"
]
},
{
"_class"
:
"Dream.Queue"
,
{
"_class"
:
"Dream.Queue
LIFO
"
,
"id"
:
"DummyQ"
,
"name"
:
"DummyQ"
,
"isDummy"
:
"1"
,
...
...
dream/simulation/LineGenerationJSON.py
View file @
cb1fc027
...
...
@@ -172,6 +172,17 @@ def createObjects():
G
.
QueueList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.QueueLIFO'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
successorList
=
element
.
get
(
'successorList'
,
'not found'
)
capacity
=
int
(
element
.
get
(
'capacity'
,
'1'
))
isDummy
=
bool
(
int
(
element
.
get
(
'isDummy'
,
'0'
)))
Q
=
QueueLIFO
(
id
,
name
,
capacity
,
isDummy
)
Q
.
nextIds
=
successorList
G
.
QueueList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.Assembly'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
...
...
dream/simulation/Machine.py
View file @
cb1fc027
...
...
@@ -245,9 +245,10 @@ class Machine(CoreObject):
def
removeEntity
(
self
):
self
.
timeLastEntityLeft
=
now
()
self
.
outputTrace
(
"releases "
+
self
.
objName
)
self
.
waitToDispose
=
False
self
.
waitToDispose
=
False
self
.
Res
.
activeQ
.
pop
(
0
)
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
#checks if the Machine can dispose an entity to the following object
def
haveToDispose
(
self
,
callerObject
=
None
):
...
...
dream/simulation/QueueLIFO.py
View file @
cb1fc027
...
...
@@ -30,9 +30,15 @@ Models a LIFO queue where entities can wait in order to get into a server
from
Queue
import
Queue
class
QueueLIFO
(
Queue
):
#gets an entity from the predecessor
def
getEntity
(
self
):
self
.
Res
.
activeQ
=
[
self
.
previous
[
0
].
Res
.
activeQ
[
0
]]
+
self
.
Res
.
activeQ
#get the entity from the previous object
#and put it in front of the activeQ
self
.
previous
[
0
].
removeEntity
()
#remove the entity from the previous object
\ No newline at end of file
activeObject
=
self
#use this to refer to the current object which receives the Entity
activeEntity
=
[
self
.
previous
[
self
.
predecessorIndex
].
Res
.
activeQ
[
0
]]
#use this to refer to the Entity that is received
giverObject
=
self
.
previous
[
self
.
predecessorIndex
]
#use this to refer to the object that disposes the entity
activeObject
.
Res
.
activeQ
=
activeEntity
+
activeObject
.
Res
.
activeQ
#get the entity from the previous object
#and put it in front of the activeQ
giverObject
.
removeEntity
()
#remove the entity from the previous object
\ No newline at end of file
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