Package edu.jas.kern

Class TimeStatus

java.lang.Object
edu.jas.kern.TimeStatus

public class TimeStatus extends Object
Run-time status, defines global status and handling for run time limits.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static boolean
    Global status flag.
    private static Callable<Boolean>
    Call back method.
    private static long
    Global run-time limit in milliseconds.
    private static long
    Global run-time limit in milliseconds.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No public constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Check for exceeded time, test if time has exceeded and throw an exception if so.
    static boolean
    isActive.
    static void
    Restart timer, set run-time to current time.
    static void
    setAllow, set run-time interruption to allowed status.
    static void
    set call back, set the Callabe object.
    static void
    setLimit(long t)
    setLimit, set run-time limit in milliseconds.
    static void
    setNotActive, set run-time interruption to not active status.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • allowTime

      private static boolean allowTime
      Global status flag.
    • limitTime

      private static long limitTime
      Global run-time limit in milliseconds.
    • startTime

      private static long startTime
      Global run-time limit in milliseconds.
    • callBack

      private static Callable<Boolean> callBack
      Call back method. true means continue, false means throw exception.
  • Constructor Details

    • TimeStatus

      protected TimeStatus()
      No public constructor.
  • Method Details

    • isActive

      public static boolean isActive()
      isActive.
      Returns:
      true, if run-time interruption is active, else false.
    • setActive

      public static void setActive()
      setAllow, set run-time interruption to allowed status.
    • setNotActive

      public static void setNotActive()
      setNotActive, set run-time interruption to not active status.
    • setLimit

      public static void setLimit(long t)
      setLimit, set run-time limit in milliseconds.
    • restart

      public static void restart()
      Restart timer, set run-time to current time.
    • setCallBack

      public static void setCallBack(Callable<Boolean> cb)
      set call back, set the Callabe object.
    • checkTime

      public static void checkTime(String msg)
      Check for exceeded time, test if time has exceeded and throw an exception if so.
      Parameters:
      msg - the message to be send with the exception.