From a26e78399c4770c22fec90b6c14ad94d33d01868 Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Sat, 7 May 2005 12:00:38 +0000 Subject: [PATCH] A Greeting Idler --- sql-edition/servers/Idler.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index 22285de..07be6ab 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -13,8 +13,8 @@ class Idler: self.v = v def next(self): - """Displays next stage of the idler""" - pass + """Displays next stage of the idler. Returns time to the next step""" + return 1 def reset(self): """Resets the idler to a known intial state""" @@ -28,6 +28,29 @@ class Idler: """How much we want this idler to be the next one chosen""" return 1 +class GreetingIdler(Idler): + def __init__(self, v, secs_to_greeting = None): + self.v = v + self.secs_to_greeting = secs_to_greeting + + def next(self): + if not self.secs_to_greeting is None: + x = self.secs_to_greeting + self.secs_to_greeting = None + return x + + self.v.display('UCC SNACKS') + return 2 + + def reset(self): + pass + + def finished(self): + return self.secs_to_greeting == None + + def affinity(self): + return 0 + class TrainIdler(Idler): def __init__(self, v): self.idle_state = 0 -- 2.20.1