Class MockScheduler

    • Constructor Detail

      • MockScheduler

        public MockScheduler()
      • MockScheduler

        public MockScheduler​(MockTimer timer)
    • Method Detail

      • schedule

        public void schedule​(long interval,
                             ReadyRunnable schedule)
        Description copied from interface: Scheduler

        schedule

        This method is used to schedule a ready runnable in the system. The interval is used as the key for determining which queue to add the runnable.
        Specified by:
        schedule in interface Scheduler
        Specified by:
        schedule in interface ScheduleTimer
        Parameters:
        interval - a long.
        schedule - a ReadyRunnable object.
      • getEntryCount

        public int getEntryCount()
      • getEntries

        public java.util.Map<java.lang.Long,​java.util.List<ReadyRunnable>> getEntries()
      • getNextTime

        public long getNextTime()
      • next

        public long next()
      • tick

        public long tick​(int step)
      • getCurrentTime

        public long getCurrentTime()
        Description copied from interface: Scheduler
        This returns the current time for the scheduler
        Specified by:
        getCurrentTime in interface Scheduler
        Specified by:
        getCurrentTime in interface Timer
        Returns:
        a long.
      • start

        public void start()
        Description copied from interface: Scheduler
        Starts the fiber.
        Specified by:
        start in interface Scheduler
      • stop

        public void stop()
        Description copied from interface: Scheduler
        Stops the fiber. If the fiber has never been run then an exception is generated.
        Specified by:
        stop in interface Scheduler
      • pause

        public void pause()
        Description copied from interface: Scheduler
        Pauses the scheduler if it is current running. If the fiber has not been run or has already stopped then an exception is generated.
        Specified by:
        pause in interface Scheduler
      • resume

        public void resume()
        Description copied from interface: Scheduler
        Resumes the scheduler if it has been paused. If the fiber has not been run or has already stopped then an exception is generated.
        Specified by:
        resume in interface Scheduler
      • getStatus

        public int getStatus()
        Description copied from interface: Scheduler
        Returns the current of this fiber.
        Specified by:
        getStatus in interface Scheduler
        Returns:
        The current status.
      • getNumTasksExecuted

        public long getNumTasksExecuted()
        Description copied from interface: Scheduler
        Returns the total number of scheduled tasks (ReadyRunnables) that have been executed since the scheduler was initialized.
        Specified by:
        getNumTasksExecuted in interface Scheduler
        Returns:
        the number of task executed