Class Demands.TimePeriods

    • Constructor Detail

      • TimePeriods

        public TimePeriods()
        Constructor
      • TimePeriods

        public TimePeriods​(Demands.TimePeriods other)
        Copy constructor
        Parameters:
        other - to copy
    • Method Detail

      • createAndRegisterNewTimePeriod

        public TimePeriod createAndRegisterNewTimePeriod​(String description,
                                                         long startTimeSeconds,
                                                         long durationSeconds)
                                                  throws PlanItException
        Factory method to create and register a new time period on the demands
        Parameters:
        description - the description for this time period
        startTimeSeconds - the start time in seconds since midnight (00:00)
        durationSeconds - the duration in seconds since start time
        Returns:
        new time period created
        Throws:
        PlanItException - thrown if start time and/or duration are invalid
      • asSortedSetByStartTime

        public SortedSet<TimePeriod> asSortedSetByStartTime()
        Returns a set of all registered time periods sorted by the start time, i.e., the way th time period is comparable
        Returns:
        Set of all registered time periods
      • getByXmlId

        public TimePeriod getByXmlId​(String xmlId)
        Retrieve a TimePeriod by its xml Id This method is not efficient, since it loops through all the registered time periods in order to find the required time period.
        Parameters:
        xmlId - the XML Id of the specified time period
        Returns:
        the retrieved time period, or null if no time period was found