/** * Update the global phenomenon time by extending the global envelope to include the specified {@code ITime}. * * @param eventTime the time to include */ default void updatePhenomenonTime(Time eventTime) { Objects.requireNonNull(eventTime, EVENT_TIME); final TimePeriod tp = toTimePeriod(eventTime); if (!hasMinPhenomenonTime() || getMinPhenomenonTime().isAfter(tp.getStart())) { setMinPhenomenonTime(tp.getStart()); } if (!hasMaxPhenomenonTime() || getMaxPhenomenonTime().isBefore(tp.getEnd())) { setMaxPhenomenonTime(tp.getEnd()); } }
/** * Update the global result time by extending the global envelope to include the specified {@code ITime}. * * @param resultTime the time to include */ default void updateResultTime(Time resultTime) { if (resultTime == null) { return; } final TimePeriod tp = toTimePeriod(resultTime); if (!hasMinResultTime() || getMinResultTime().isAfter(tp.getStart())) { setMinResultTime(tp.getStart()); } if (!hasMaxResultTime() || getMaxResultTime().isBefore(tp.getEnd())) { setMaxResultTime(tp.getEnd()); } }
/** * Updates the phenomenon time envelope of the specified procedure to include the specified event time. * * @param procedure the procedure * @param eventTime the time to include */ default void updatePhenomenonTimeForProcedure(String procedure, Time eventTime) { CacheValidation.notNullOrEmpty(PROCEDURE, procedure); Objects.requireNonNull(eventTime, EVENT_TIME); final TimePeriod tp = toTimePeriod(eventTime); if (!hasMaxPhenomenonTimeForProcedure(procedure) || getMaxPhenomenonTimeForProcedure(procedure).isBefore(tp.getEnd())) { setMaxPhenomenonTimeForProcedure(procedure, tp.getEnd()); } if (!hasMinPhenomenonTimeForProcedure(procedure) || getMinPhenomenonTimeForProcedure(procedure).isAfter(tp.getStart())) { setMinPhenomenonTimeForProcedure(procedure, tp.getStart()); } }
/** * Updates the result time envelope of the specified offering to include the specified result time. * * @param offering the offering * @param resultTime the time to include */ default void updateResultTimeForOffering(String offering, Time resultTime) { CacheValidation.notNullOrEmpty(OFFERING, offering); if (resultTime == null) { return; } final TimePeriod tp = toTimePeriod(resultTime); if (!hasMaxResultTimeForOffering(offering) || getMaxResultTimeForOffering(offering).isBefore(tp.getEnd())) { setMaxResultTimeForOffering(offering, tp.getEnd()); } if (!hasMinResultTimeForOffering(offering) || getMinResultTimeForOffering(offering).isAfter(tp.getStart())) { setMinResultTimeForOffering(offering, tp.getStart()); } }
/** * Updates the phenomenon time envelope of the specified offering to include the specified event time. * * @param offering the offering * @param eventTime the time to include */ default void updatePhenomenonTimeForOffering(String offering, Time eventTime) { CacheValidation.notNullOrEmpty(OFFERING, offering); Objects.requireNonNull(eventTime, EVENT_TIME); final TimePeriod tp = toTimePeriod(eventTime); if (!hasMaxPhenomenonTimeForOffering(offering) || getMaxPhenomenonTimeForOffering(offering).isBefore(tp.getEnd())) { setMaxPhenomenonTimeForOffering(offering, tp.getEnd()); } if (!hasMinPhenomenonTimeForOffering(offering) || getMinPhenomenonTimeForOffering(offering).isAfter(tp.getStart())) { setMinPhenomenonTimeForOffering(offering, tp.getStart()); } }