Package jisa.control

Class RTask


  • public class RTask
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  RTask.Task  
    • Constructor Summary

      Constructors 
      Constructor Description
      RTask​(long interval, RTask.Task toRun)
      Creates a repeating task to run at the given interval.
      RTask​(long interval, SRunnable toRun)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCount()
      Returns how many times the task has been run since the timer was last started.
      long getInterval()  
      long getMSecFromStart()
      Returns the number of milliseconds that have elapsed since the task was started.
      double getSecFromStart()
      Returns the time that has elapsed since the task was started, in seconds.
      RTask.Task getTask()  
      boolean isRunning()
      Is the task currently set to run?
      void setInterval​(long interval)  
      void setTask​(RTask.Task task)  
      void start()
      Start the timer to periodically run the task.
      void stop()
      Stop the timer from running the task.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RTask

        public RTask​(long interval,
                     RTask.Task toRun)
        Creates a repeating task to run at the given interval.
        Parameters:
        interval - Interval, in milliseconds
        toRun - Code to run at each interval
      • RTask

        public RTask​(long interval,
                     SRunnable toRun)
    • Method Detail

      • setInterval

        public void setInterval​(long interval)
      • getInterval

        public long getInterval()
      • setTask

        public void setTask​(RTask.Task task)
      • start

        public void start()
        Start the timer to periodically run the task.
      • stop

        public void stop()
        Stop the timer from running the task.
      • isRunning

        public boolean isRunning()
        Is the task currently set to run?
        Returns:
        Running?
      • getMSecFromStart

        public long getMSecFromStart()
        Returns the number of milliseconds that have elapsed since the task was started.
        Returns:
        Time running, in milliseconds
      • getSecFromStart

        public double getSecFromStart()
        Returns the time that has elapsed since the task was started, in seconds.
        Returns:
        Time running, in seconds
      • getCount

        public int getCount()
        Returns how many times the task has been run since the timer was last started.
        Returns:
        Run count