- Tadaaaan! Fixed it! Now:

- SWIG generate interface doesn't do a mess with namespaces anymore
  - Improved PythonPolicy to be acceptably faster
  - FCFS implemented, sir!
  - FIXME : the qsort implementation doesn't seem right


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@413 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-02-23 21:50:43 +00:00
parent 876fb85614
commit dfe1593b44
4 changed files with 53 additions and 31 deletions

View file

@ -1,4 +1,5 @@
from Policy import Policy
import sys
class fcfs(Policy) :
def __init__(self):
@ -15,19 +16,12 @@ class fcfs(Policy) :
def sort_queue(self, event, queue):
print 'Entering sort_queue'
print queue.size()
print queue.get_item_at(0)
print dir(queue.get_item_at(0))
for i in range(0, queue.size()):
ss = queue.get_item_at(i)
print ss.get_schedulable().get_name()
# Uncomment this to try the qsort algorithm with FCFS
#cmpf = lambda a, b: \
# a.get_schedulable().get_arrival_time() < \
# b.get_schedulable().get_arrival_time()
#try:
# self.sort(queue,cmpf)
#except:
# print "Unexpected error:", sys.exc_info()[0]
# raise
cmpf = lambda a, b: \
a.get_schedulable().get_arrival_time() < \
b.get_schedulable().get_arrival_time()
try:
self.sort(queue,cmpf)
except:
print "Unexpected error:", sys.exc_info()[0]
raise