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
e15a8531
Commit
e15a8531
authored
Jan 16, 2014
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Jan 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments populated in BatchReassembly
parent
2b18a52c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+19
-5
No files found.
dream/simulation/BatchReassembly.py
View file @
e15a8531
...
@@ -77,7 +77,9 @@ class BatchReassembly(CoreObject):
...
@@ -77,7 +77,9 @@ class BatchReassembly(CoreObject):
CoreObject
.
initialize
(
self
)
# using the default CoreObject Functionality
CoreObject
.
initialize
(
self
)
# using the default CoreObject Functionality
self
.
Res
=
Resource
(
self
.
numberOfSubBatches
)
# initialize the Internal resource (Queue) functionality
self
.
Res
=
Resource
(
self
.
numberOfSubBatches
)
# initialize the Internal resource (Queue) functionality
# =======================================================================
# the main method of the object
# =======================================================================
def
run
(
self
):
def
run
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
...
@@ -97,7 +99,9 @@ class BatchReassembly(CoreObject):
...
@@ -97,7 +99,9 @@ class BatchReassembly(CoreObject):
yield
hold
,
self
,
self
.
calculateProcessingTime
()
yield
hold
,
self
,
self
.
calculateProcessingTime
()
self
.
reassemble
()
self
.
reassemble
()
# =======================================================================
# reassemble method that assembles the subBatches back together to a Batch
# =======================================================================
def
reassemble
(
self
):
def
reassemble
(
self
):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
# get the internal queue of the active core object
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
# get the internal queue of the active core object
...
@@ -123,6 +127,11 @@ class BatchReassembly(CoreObject):
...
@@ -123,6 +127,11 @@ class BatchReassembly(CoreObject):
batchToBeReassembled
.
currentStation
=
self
batchToBeReassembled
.
currentStation
=
self
self
.
timeLastEntityEnded
=
now
()
self
.
timeLastEntityEnded
=
now
()
# =======================================================================
# returns True if the object doensn't hold entities of type Batch
# and if the subBatches in the its internal queue and the one of the giver
# hold subBatches of the same batchId
# =======================================================================
def
canAccept
(
self
,
callerObject
=
None
):
def
canAccept
(
self
,
callerObject
=
None
):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
...
@@ -148,8 +157,9 @@ class BatchReassembly(CoreObject):
...
@@ -148,8 +157,9 @@ class BatchReassembly(CoreObject):
and
activeObjectQueue
[
0
].
type
!=
'Batch'
\
and
activeObjectQueue
[
0
].
type
!=
'Batch'
\
and
giverObjectQueue
[
0
].
batchId
==
activeObjectQueue
[
0
].
batchId
and
giverObjectQueue
[
0
].
batchId
==
activeObjectQueue
[
0
].
batchId
# =======================================================================
# returns True if it holds an entity of type Batch
# =======================================================================
def
haveToDispose
(
self
,
callerObject
=
None
):
def
haveToDispose
(
self
,
callerObject
=
None
):
# get active and the receiver object
# get active and the receiver object
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
...
@@ -178,7 +188,11 @@ class BatchReassembly(CoreObject):
...
@@ -178,7 +188,11 @@ class BatchReassembly(CoreObject):
and
(
thecaller
is
receiverObject
)
\
and
(
thecaller
is
receiverObject
)
\
and
activeObjectQueue
[
0
].
type
!=
"Batch"
# the control of the length of the queue is not needed
and
activeObjectQueue
[
0
].
type
!=
"Batch"
# the control of the length of the queue is not needed
# =======================================================================
# returns true if the giver has an entity to dispose
# which is of the same batchId as the ones that the assembler currently holds
# (if it holds any), and if doesn't hold any entities of type Batch
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
):
# get the active and the giver objects
# get the active and the giver objects
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
...
...
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