class sort_m2_data1000_exec(): def __init__(self): self._sort_m2_data1000 = sort_m2_data1000() self.counter = BInteger(0) self.sorted = BInteger(0) def simulate(self): while (self.sorted.less(BInteger(500))).booleanValue(): self.counter = BInteger(0) while (self.counter.less(BInteger(999).minus(BInteger(2).multiply(self.sorted)))).booleanValue(): self._sort_m2_data1000.prog2() self.counter = self.counter.plus(BInteger(1)) self.counter = BInteger(0) while (self.counter.less(self.sorted)).booleanValue(): self._sort_m2_data1000.prog1() self.counter = self.counter.plus(BInteger(1)) self._sort_m2_data1000.progress() self.sorted = self.sorted.plus(BInteger(1)) while (self.sorted.less(BInteger(999))).booleanValue(): self.counter = BInteger(0) while (self.counter.less(BInteger(999).minus(self.sorted))).booleanValue(): self._sort_m2_data1000.prog1() self.counter = self.counter.plus(BInteger(1)) self._sort_m2_data1000.progress() self.sorted = self.sorted.plus(BInteger(1)) self._sort_m2_data1000.final_evt()
def simulate(self): while (self.counter.less(BInteger(10000000))).booleanValue(): i = None i = BInteger(0) while (i.less(BInteger(100))).booleanValue(): self._Lift.inc() i = i.plus(BInteger(1)) _i = None _i = BInteger(0) while (_i.less(BInteger(100))).booleanValue(): self._Lift.dec() _i = _i.plus(BInteger(1)) self.counter = self.counter.plus(BInteger(1))
class Sieve: def __init__(self): self.numbers = BSet.interval(BInteger(2), BInteger(2000000)) self.cur = BInteger(2) self.limit = BInteger(2000000) def ComputeNumberOfPrimes(self): while (BBoolean( self.cur.greater(BInteger(1)).booleanValue() and self.cur.multiply(self.cur).lessEqual( self.limit).booleanValue())).booleanValue(): if (self.numbers.elementOf(self.cur)).booleanValue(): n = self.cur set = BSet() while (n.lessEqual(self.limit.divide( self.cur))).booleanValue(): set = set.union(BSet(self.cur.multiply(n))) n = n.plus(BInteger(1)) self.numbers = self.numbers.difference(set) self.cur = self.cur.plus(BInteger(1)) res = self.numbers.card() return res
class LiftExec: def __init__(self): self._Lift = Lift() self.counter = BInteger(0) def simulate(self): while (self.counter.less(BInteger(10000000))).booleanValue(): i = None i = BInteger(0) while (i.less(BInteger(100))).booleanValue(): self._Lift.inc() i = i.plus(BInteger(1)) _i = None _i = BInteger(0) while (_i.less(BInteger(100))).booleanValue(): self._Lift.dec() _i = _i.plus(BInteger(1)) self.counter = self.counter.plus(BInteger(1)) def getCounter(self): out = None out = self.counter return out
class Lift: def __init__(self): self.floor = BInteger(0) def inc(self): self.floor = self.floor.plus(BInteger(1)) def dec(self): self.floor = self.floor.minus(BInteger(1)) def _get_floor(self): return self.floor
class TrafficLightExec: def __init__(self): self._TrafficLight = TrafficLight() self.counter = BInteger(0) def simulate(self): while (self.counter.less(BInteger(300000000))).booleanValue(): self._TrafficLight.cars_ry() self._TrafficLight.cars_g() self._TrafficLight.cars_y() self._TrafficLight.cars_r() self._TrafficLight.peds_g() self._TrafficLight.peds_r() self.counter = self.counter.plus(BInteger(1))
class scheduler_deterministic_exec: def __init__(self): self._scheduler_deterministic = scheduler_deterministic() self.counter = BInteger(0) def simulate(self): while ((self.counter.less(BInteger(300000))).booleanValue()): self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic.new(PID.process2) self._scheduler_deterministic.new(PID.process3) self._scheduler_deterministic._del(PID.process1) self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic._del(PID.process2) self._scheduler_deterministic._del(PID.process1) self._scheduler_deterministic._del(PID.process3) self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic.new(PID.process2) self._scheduler_deterministic._del(PID.process1) self._scheduler_deterministic.ready(PID.process2) self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic.new(PID.process3) self._scheduler_deterministic._del(PID.process1) self._scheduler_deterministic.ready(PID.process3) self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic.ready(PID.process1) self._scheduler_deterministic.swap(PID.process1) self._scheduler_deterministic._del(PID.process2) self._scheduler_deterministic.swap(PID.process3) self._scheduler_deterministic.new(PID.process2) self._scheduler_deterministic._del(PID.process1) self._scheduler_deterministic._del(PID.process2) self._scheduler_deterministic.swap(PID.process1) self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic.new(PID.process2) self._scheduler_deterministic._del(PID.process1) self._scheduler_deterministic._del(PID.process3) self._scheduler_deterministic.new(PID.process1) self._scheduler_deterministic._del(PID.process2) self._scheduler_deterministic._del(PID.process1) self.counter = self.counter.plus(BInteger(1))
class Train_1_beebook_deterministic_exec: def __init__(self): self._Train_1_beebook_deterministic = Train_1_beebook_deterministic() self.counter = BInteger(0) def simulate(self): while ((self.counter.less(BInteger(10000))).booleanValue()): self._Train_1_beebook_deterministic.route_reservation(ROUTES.R1) self._Train_1_beebook_deterministic.route_reservation(ROUTES.R4) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R1) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R4) self._Train_1_beebook_deterministic.route_formation(ROUTES.R1) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R1) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.L) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.L) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.C) self._Train_1_beebook_deterministic.route_reservation(ROUTES.R6) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R1) self._Train_1_beebook_deterministic.route_formation(ROUTES.R4) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R6) self._Train_1_beebook_deterministic.route_formation(ROUTES.R6) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R4) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.M) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R6) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.C) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.H) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.C) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.M) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.I) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.H) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.I) self._Train_1_beebook_deterministic.route_reservation(ROUTES.R5) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R5) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.K) self._Train_1_beebook_deterministic.route_formation(ROUTES.R5) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.K) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.F) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.F) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R5) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.M) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.M) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.H) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.H) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.I) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.J) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.L) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.G) self._Train_1_beebook_deterministic.route_reservation(ROUTES.R1) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R1) self._Train_1_beebook_deterministic.route_formation(ROUTES.R1) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R4) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.I) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.J) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R6) self._Train_1_beebook_deterministic.route_reservation(ROUTES.R9) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R1) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.N) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R9) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.L) self._Train_1_beebook_deterministic.route_formation(ROUTES.R9) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R5) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.L) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R9) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.G) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.G) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.F) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.C) self._Train_1_beebook_deterministic.route_reservation(ROUTES.R6) self._Train_1_beebook_deterministic.point_positionning(ROUTES.R6) self._Train_1_beebook_deterministic.route_formation(ROUTES.R6) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.F) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R1) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.K) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.I) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.H) self._Train_1_beebook_deterministic.FRONT_MOVE_1(ROUTES.R6) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.C) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.FRONT_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.K) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.I) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.H) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.C) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.B) self._Train_1_beebook_deterministic.BACK_MOVE_2(BLOCKS.A) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.L) self._Train_1_beebook_deterministic.BACK_MOVE_1(BLOCKS.M) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R6) self._Train_1_beebook_deterministic.route_freeing(ROUTES.R9) self.counter = self.counter.plus(BInteger(1))