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
a83ac1c5
Commit
a83ac1c5
authored
Mar 06, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine getEntity updated to remove entities it receives from the global pendingEntities list
parent
12e7ee0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
dream/simulation/Machine.py
dream/simulation/Machine.py
+12
-6
No files found.
dream/simulation/Machine.py
View file @
a83ac1c5
...
@@ -273,12 +273,6 @@ class Machine(CoreObject):
...
@@ -273,12 +273,6 @@ class Machine(CoreObject):
# TODO: the Machine receive the entity after the operator is available
# TODO: the Machine receive the entity after the operator is available
# the canAcceptAndIsRequested method checks only in case of Load type of operation
# the canAcceptAndIsRequested method checks only in case of Load type of operation
# after the machine receives an entity, it must be removed from the pendingEntities list
# TODO: consider incorporating it in the getEntity of the machine
from
Globals
import
G
if
self
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
self
.
currentEntity
)
# ======= request a resource if it is not already assigned an Operator
# ======= request a resource if it is not already assigned an Operator
if
(
self
.
operatorPool
!=
"None"
)
\
if
(
self
.
operatorPool
!=
"None"
)
\
and
(
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
)
\
and
(
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
)
\
...
@@ -663,6 +657,18 @@ class Machine(CoreObject):
...
@@ -663,6 +657,18 @@ class Machine(CoreObject):
# =======================================================================
# =======================================================================
def
ifCanDisposeOrHaveFailure
(
self
):
def
ifCanDisposeOrHaveFailure
(
self
):
return
self
.
Up
==
False
or
self
.
getReceiverObject
().
canAccept
(
self
)
or
len
(
self
.
getActiveObjectQueue
())
==
0
return
self
.
Up
==
False
or
self
.
getReceiverObject
().
canAccept
(
self
)
or
len
(
self
.
getActiveObjectQueue
())
==
0
# =======================================================================
# get an entity from the giver
# =======================================================================
def
getEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeEntity
=
CoreObject
.
getEntity
(
self
)
# run the default method
# after the machine receives an entity, it must be removed from the pendingEntities list
from
Globals
import
G
if
activeEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
activeEntity
)
return
activeEntity
# =======================================================================
# =======================================================================
# removes an entity from the Machine
# removes an entity from the Machine
...
...
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