Class OperationTime

java.lang.Object
edu.ie3.datamodel.models.OperationTime
All Implemented Interfaces:
Serializable

public class OperationTime extends Object implements Serializable
Time for which something is operated, can be limited to a time frame with one or two bounds or not limited which is by definition equal to always on
See Also:
  • Constructor Details

    • OperationTime

      protected OperationTime(ZonedDateTime startDate, ZonedDateTime endDate, boolean isLimited)
      Constructor for builder only
      Parameters:
      startDate - Beginning of the operation period
      endDate - End of the operation period
      isLimited - true, if operation is timely bound
  • Method Details

    • notLimited

      public static OperationTime notLimited()
      Returns:
      an OperationTime without time limitations (= always on)
    • getStartDate

      public Optional<ZonedDateTime> getStartDate()
      Returns:
      date of operation start, if present
    • getEndDate

      public Optional<ZonedDateTime> getEndDate()
      Returns:
      date of operation end, if present
    • isLimited

      public boolean isLimited()
    • getOperationLimit

      public Optional<edu.ie3.util.interval.ClosedInterval<ZonedDateTime>> getOperationLimit()
      Returns:
      Optional.empty(), if the time frame is unlimited

      Optional.of(ClosedInterval(startDate, endDate)), if the upper and lower bound is set

      Optional.of((ClosedInterval(startDate, LocalDateTime.MAX)), if only the lower bound is set

      Optional.of((ClosedInterval(LocalDateTime.MIN, endDate)), if only the upper bound is set
    • includes

      public boolean includes(ZonedDateTime date)
      Check if given date is included in the operation time frame
      Parameters:
      date - Questioned date
      Returns:
      true, if the date is included or there are no operation time limitations, else false
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

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

      public static OperationTime.OperationTimeBuilder builder()
      Returns:
      OperationTimeBuilder instance