Class Window

java.lang.Object
gov.nasa.jpl.scheduler.Window
All Implemented Interfaces:
Comparable<Window>

public class Window extends Object implements Comparable<Window>
  • Constructor Details

  • Method Details

    • getStart

      public Time getStart()
    • getEnd

      public Time getEnd()
    • getType

      public String getType()
    • hasEnd

      public boolean hasEnd()
    • getDuration

      public Duration getDuration()
    • getMidpoint

      public Time getMidpoint()
    • contains

      public boolean contains(Time t)
      Returns true if the parameter time is within the calling Window, inclusive
      Parameters:
      t -
      Returns:
    • contains

      public boolean contains(Window w)
      Returns true if the parameter Window is within the calling Window, inclusive
      Parameters:
      w -
      Returns:
    • intersects

      public boolean intersects(Window w)
      Returns true if the parameter Window intersects the calling Window
      Parameters:
      w -
      Returns:
    • hasLengthZero

      public boolean hasLengthZero()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Window w)
      Specified by:
      compareTo in interface Comparable<Window>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • sum

      public static Duration sum(Window[] windows)
      Returns a duration equal to the sum of all the durations in the provided list
      Parameters:
      windows -
      Returns:
    • getWindows

      public static Window[] getWindows(Condition condition, Time queryStart, Time queryEnd)
      Returns an array of window objects where the input condition is met within the start and end time provided.
      Parameters:
      condition -
      queryStart -
      queryEnd -
      Returns:
    • interpWindows

      public static Window[] interpWindows(Condition condition, Time queryStart, Time queryEnd)
      Returns an array of window objects where the input condition is met within the start and end time provided. Unlike getWindows, this method interprets double resources to determine the time when the value crosses a threshold. Currently only works for single-node conditions whose resource is a DoubleResource.
      Parameters:
      condition -
      queryStart -
      queryEnd -
      Returns:
    • getIntersectingWindowInList

      public Window getIntersectingWindowInList(NavigableSet<Window> windowsToCheck)
      Returns original Window object from windowsToCheck that intersects this/self, or null if there are no intersections. This is different from Window.and() because it preserves the full length and type of the conflicting window, not just the intersection portion
      Parameters:
      windowsToCheck - Windows to check for intersections with win - ASSUMPTION is that no windows in windowsToCheck overlap
      Returns:
      the intersecting original Window object, or null if there are no intersections. If multiple windows in windowsToCheck intersect this/self, the first one is returned
    • and

      public static Window[] and(Window[] win1, Window[] win2)
    • or

      public static Window[] or(Window[] win1, Window[] win2)
    • xor

      public static Window[] xor(Window[] win1, Window[] win2)
    • not

      public static Window[] not(Window[] win1, Time queryBegin, Time queryEnd)
    • merge

      public static Window[] merge(Window[] toBeMerged, Duration threshold)
      Loops through list of windows and returns list where entries separated by less than Duration parameter are merged
      Parameters:
      toBeMerged - List of Windows, must be sorted already
      threshold - Duration between adjacent windows below which they will be merged together
      Returns:
      A new Window array containing the merged list