Skip to content
Snippets Groups Projects
core.py 566 B
Newer Older
  • Learn to ignore specific revisions
  • Jarrod Pas's avatar
    Jarrod Pas committed
    class Process:
        def __init__(self):
            self.env = None
            self.__process = None
    
    Jarrod Pas's avatar
    Jarrod Pas committed
    
    
    Jarrod Pas's avatar
    Jarrod Pas committed
        def start(self, env, *args):
    
    Jarrod Pas's avatar
    Jarrod Pas committed
            self.env = env
    
    Jarrod Pas's avatar
    Jarrod Pas committed
            self.__process = env.process(self.process(*args))
    
    Jarrod Pas's avatar
    Jarrod Pas committed
    
    
    Jarrod Pas's avatar
    Jarrod Pas committed
        def process(self, *args):
            raise NotImplementedError
    
    Jarrod Pas's avatar
    Jarrod Pas committed
    
    
    
    Jarrod Pas's avatar
    Jarrod Pas committed
    class TickProcess(Process):
        def __init__(self, tick):
            super().__init__()
            if tick < 1:
                raise ValueError('tick must be greatert than or equal to 1')
    
    Jarrod Pas's avatar
    Jarrod Pas committed
            self._tick = tick
    
    
        def tick(self):
    
    Jarrod Pas's avatar
    Jarrod Pas committed
            return self.env.timeout(self._tick)
    
    Jarrod Pas's avatar
    Jarrod Pas committed