Class Window

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long endMs  
      protected long startMs  
    • Constructor Summary

      Constructors 
      Constructor Description
      Window​(long startMs, long endMs)
      Create a new window for the given start and end time.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      long end()
      Return the end timestamp of this window.
      java.time.Instant endTime()
      Return the end time of this window.
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      abstract boolean overlap​(Window other)
      Check if the given window overlaps with this window.
      long start()
      Return the start timestamp of this window.
      java.time.Instant startTime()
      Return the start time of this window.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • startMs

        protected final long startMs
      • endMs

        protected final long endMs
    • Constructor Detail

      • Window

        public Window​(long startMs,
                      long endMs)
               throws java.lang.IllegalArgumentException
        Create a new window for the given start and end time.
        Parameters:
        startMs - the start timestamp of the window
        endMs - the end timestamp of the window
        Throws:
        java.lang.IllegalArgumentException - if startMs is negative or if endMs is smaller than startMs
    • Method Detail

      • start

        public long start()
        Return the start timestamp of this window.
        Returns:
        The start timestamp of this window.
      • end

        public long end()
        Return the end timestamp of this window.
        Returns:
        The end timestamp of this window.
      • startTime

        public java.time.Instant startTime()
        Return the start time of this window.
        Returns:
        The start time of this window.
      • endTime

        public java.time.Instant endTime()
        Return the end time of this window.
        Returns:
        The end time of this window.
      • overlap

        public abstract boolean overlap​(Window other)
        Check if the given window overlaps with this window. Should throw an IllegalArgumentException if the other window has a different type than this window.
        Parameters:
        other - another window of the same type
        Returns:
        true if other overlaps with this window—false otherwise
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object