Class Waiter

java.lang.Object
gov.nasa.jpl.engine.Waiter
All Implemented Interfaces:
Comparable<Waiter>

public class Waiter extends Object implements Comparable<Waiter>
A Waiter is an object stored by the engine that tells it to run a certain function (Activity model()) at a certain time. Supports 'pausing' and 'resuming' thread by returning new object holding a subset of original model function
  • Constructor Details

    • Waiter

      public Waiter(Time t, int priority, Supplier<Waiter> func)
      Constructs a waiter to execute at the given Time with the given priority.
      Parameters:
      t - The Time this Waiter should execute.
      priority - Used to further prioritize Waiters that execute at the same time but under different contextual meanings. By convention the modeling engine uses the following values: priority = -1 -> signaled activities (immediately) priority = 0 -> resumed activities (before activity end) priority = 1 -> new activities (at activity start)
  • Method Details

    • getTime

      public Time getTime()
      Returns:
      The Time which this Waiter will execute
    • compareTo

      public int compareTo(Waiter o)
      Sorts waiters by runtime and then priority.
      Specified by:
      compareTo in interface Comparable<Waiter>
      Parameters:
      o - the object to be compared.
      Returns: