psl.worklets
Class JunctionPlanner

java.lang.Object
  |
  +--psl.worklets.JunctionPlanner
All Implemented Interfaces:
java.io.Serializable

public class JunctionPlanner
extends java.lang.Object
implements java.io.Serializable

Provides meta-information pertaining to a Worklet Junction. Make sure you call init(WorkletJunction) before the WorkletJunction uses the JunctionPlanner.

Notes

  • to run instantly, run with a delay of 0
  • to run with an indefinite wait, run with a delay of -1 (or any negative number)
  • _interval and _date are mutually exclusive
  • See Also:
    Serialized Form

    Field Summary
    private  java.util.Date _date
              Date to execute at.
    private  long _interval
              Time to wait between iterations (in milliseconds, default = 0).
    private  int _iterations
              Number of times to execute (default = 1)
    private  psl.worklets.WorkletJunction _parent
              Reference to the WorkletJunction associated with the JunctionPlanner
    private  int _state
              Current state of the WorkletJunction
    private  java.lang.Object _system
              The host adapter that acts as a reference to the target system
    private  java.util.Timer _timer
              Timer associated with keeping track of the delay between iterations.
    private  java.util.TimerTask _timerTask
              TimerTask associated with the Timer
    private  boolean _timerTask_done
              Checks whether the TimerTask has been canceled.
    private  psl.worklets.WVM _wvm
              The local WVM.
    static int STATE_READY
              WorkletJunction is ready to be run
    static int STATE_RUNNING
              WorkletJunction is running
    static int STATE_TERMINATED
              WorkletJunction is terminated
    static int STATE_WAIT_INDEF
              WorkletJunction is waiting for an indefinite period of time
    static int STATE_WAITING
              WorkletJunction is waiting for a predetermined period of time
     
    Constructor Summary
      JunctionPlanner(java.util.Date date)
              dp2041 Creates a JunctionPlanner to execute the given number of iterations at every Date
      JunctionPlanner(int iterations, long interval)
              Creates a JunctionPlanner to execute the given number of iterations at every interval
    private JunctionPlanner(int iterations, long interval, java.util.Date date)
              Private general constructor used by other public constructors
     
    Method Summary
    private  void _wait()
              My implementation of a wait function that also keeps track of the state of the WorkletJunction
    (package private)  void cancel()
              Cancel a WorkletJunction from further execution
    (package private)  java.util.Date date()
              Gets the current Date at which to execute
    (package private)  void init(psl.worklets.WorkletJunction parent)
              Initialize the JunctionPlanner by giving it a reference to the corresponding WorkletJunction
    (package private)  long interval()
              Gets the current interval value
    (package private)  int iterations()
              Gets the current number of iterations left to execute
    (package private)  void setDate(java.util.Date date)
              Resets the Date at which to execute
    (package private)  void setInterval(long interval)
              Resets the interval value
    (package private)  void setIterations(int i)
              Resets the number of iterations to execute
    (package private)  void setState(int state)
              Sets the state of the WorkletJunction
    (package private)  java.lang.String sstate()
              Gets the string meaning of the state
    (package private)  void start()
              Starts up the Junction Planner.
    (package private)  int state()
              return the current state of the WorkletJunction
    (package private)  void wakeUp()
              Wakup a JunctionPlanner in the waiting state (STATE_WAITING or STATE_WAIT_INDEF)
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    STATE_READY

    public static final int STATE_READY
    WorkletJunction is ready to be run

    See Also:
    Constant Field Values

    STATE_WAITING

    public static final int STATE_WAITING
    WorkletJunction is waiting for a predetermined period of time

    See Also:
    Constant Field Values

    STATE_WAIT_INDEF

    public static final int STATE_WAIT_INDEF
    WorkletJunction is waiting for an indefinite period of time

    See Also:
    Constant Field Values

    STATE_RUNNING

    public static final int STATE_RUNNING
    WorkletJunction is running

    See Also:
    Constant Field Values

    STATE_TERMINATED

    public static final int STATE_TERMINATED
    WorkletJunction is terminated

    See Also:
    Constant Field Values

    _wvm

    private transient psl.worklets.WVM _wvm
    The local WVM.


    _system

    private transient java.lang.Object _system
    The host adapter that acts as a reference to the target system


    _parent

    private psl.worklets.WorkletJunction _parent
    Reference to the WorkletJunction associated with the JunctionPlanner


    _state

    private int _state
    Current state of the WorkletJunction


    _iterations

    private int _iterations
    Number of times to execute (default = 1)


    _interval

    private long _interval
    Time to wait between iterations (in milliseconds, default = 0). Set to -1 to wait indefinetly


    _date

    private java.util.Date _date
    Date to execute at.


    _timer

    private java.util.Timer _timer
    Timer associated with keeping track of the delay between iterations.


    _timerTask

    private java.util.TimerTask _timerTask
    TimerTask associated with the Timer


    _timerTask_done

    private boolean _timerTask_done
    Checks whether the TimerTask has been canceled.

    Constructor Detail

    JunctionPlanner

    private JunctionPlanner(int iterations,
                            long interval,
                            java.util.Date date)
    Private general constructor used by other public constructors


    JunctionPlanner

    public JunctionPlanner(int iterations,
                           long interval)
    Creates a JunctionPlanner to execute the given number of iterations at every interval


    JunctionPlanner

    public JunctionPlanner(java.util.Date date)
    dp2041 Creates a JunctionPlanner to execute the given number of iterations at every Date

    Method Detail

    init

    void init(psl.worklets.WorkletJunction parent)
    Initialize the JunctionPlanner by giving it a reference to the corresponding WorkletJunction


    start

    void start()
    Starts up the Junction Planner. This is the main method called by the WorkletJunction to use the JunctionPlanner.


    _wait

    private void _wait()
    My implementation of a wait function that also keeps track of the state of the WorkletJunction


    wakeUp

    void wakeUp()
    Wakup a JunctionPlanner in the waiting state (STATE_WAITING or STATE_WAIT_INDEF)


    cancel

    void cancel()
    Cancel a WorkletJunction from further execution


    setIterations

    void setIterations(int i)
    Resets the number of iterations to execute


    iterations

    int iterations()
    Gets the current number of iterations left to execute

    Returns:
    current number of iterations left to execute

    setDate

    void setDate(java.util.Date date)
    Resets the Date at which to execute


    date

    java.util.Date date()
    Gets the current Date at which to execute

    Returns:
    current Date at which to execute

    setInterval

    void setInterval(long interval)
    Resets the interval value


    interval

    long interval()
    Gets the current interval value

    Returns:
    current interval value

    setState

    void setState(int state)
    Sets the state of the WorkletJunction

    Parameters:
    state -

    state

    int state()
    return the current state of the WorkletJunction

    Returns:
    current state of the WorkletJunction

    sstate

    java.lang.String sstate()
    Gets the string meaning of the state

    Returns:
    string meaning of the state