Commit bc5fb8a0 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

CoreObject corrected

parent 2d4941fa
...@@ -445,7 +445,7 @@ class CoreObject(ManPyObject): ...@@ -445,7 +445,7 @@ class CoreObject(ManPyObject):
@staticmethod @staticmethod
def findReceiversFor(activeObject): def findReceiversFor(activeObject):
receivers=[] receivers=[]
for object in [x for x in activeObject.next if x.canAccept(activeObject) and not x.isRequested.triggered]: for object in [x for x in activeObject.next if x.canAccept(activeObject) and not x.isRequested.triggered and x.expectedSignals['isRequested']]:
receivers.append(object) receivers.append(object)
return receivers return receivers
...@@ -490,9 +490,8 @@ class CoreObject(ManPyObject): ...@@ -490,9 +490,8 @@ class CoreObject(ManPyObject):
self.printTrace(self.id, signalReceiver=self.receiver.id) self.printTrace(self.id, signalReceiver=self.receiver.id)
# assign the entry of the receiver # assign the entry of the receiver
self.receiver.assignEntryTo() self.receiver.assignEntryTo()
if self.receiver.expectedSignals['isRequested']: succeedTuple=(self,self.env.now)
succeedTuple=(self,self.env.now) self.receiver.isRequested.succeed(succeedTuple)
self.receiver.isRequested.succeed(succeedTuple)
return True return True
# if no receiver can accept then try to preempt a receive if the stations holds a critical order # if no receiver can accept then try to preempt a receive if the stations holds a critical order
self.preemptReceiver() self.preemptReceiver()
...@@ -528,7 +527,7 @@ class CoreObject(ManPyObject): ...@@ -528,7 +527,7 @@ class CoreObject(ManPyObject):
@staticmethod @staticmethod
def findGiversFor(activeObject): def findGiversFor(activeObject):
givers=[] givers=[]
for object in [x for x in activeObject.previous if(not x is activeObject) and not x.canDispose.triggered]: for object in [x for x in activeObject.previous if(not x is activeObject) and not x.canDispose.triggered and x.expectedSignals['canDispose']]:
if object.haveToDispose(activeObject): if object.haveToDispose(activeObject):
givers.append(object) givers.append(object)
return givers return givers
...@@ -564,9 +563,8 @@ class CoreObject(ManPyObject): ...@@ -564,9 +563,8 @@ class CoreObject(ManPyObject):
self.giver.receiver=self self.giver.receiver=self
if self.giver.expectedSignals['canDispose']: if self.giver.expectedSignals['canDispose']:
self.printTrace(self.id, signalGiver=self.giver.id) self.printTrace(self.id, signalGiver=self.giver.id)
if self.giver.expectedSignals['canDispose']: succeedTuple=(self,self.env.now)
succeedTuple=(self,self.env.now) self.giver.canDispose.succeed(succeedTuple)
self.giver.canDispose.succeed(succeedTuple)
return True return True
return False return False
......
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