Package com.dna.jopt.member.unit.hours
Class OpeningHours
java.lang.Object
com.dna.jopt.member.unit.hours.AbstractDutyHours
com.dna.jopt.member.unit.hours.OpeningHours
- All Implemented Interfaces:
IDutyHours,IOpeningHours,Serializable,Comparable<IDutyHours>
The hours in which
INode can be given service by IResource.
Giving service to a Node outside of the OpeningHours will trigger a IViolation
and will produce additional costs.- Since:
- 14/08/2019
- Version:
- 14/08/2019
- Author:
- DNA
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.dna.jopt.member.unit.hours.IDutyHours
IDutyHours.DutyHoursFlavour -
Constructor Summary
ConstructorsConstructorDescriptionOpeningHours(long hoursBeginMillis, long hoursEndMillis) Deprecated.OpeningHours(TimeWindow window) OpeningHours(TimeWindow access, TimeWindow service) OpeningHours(TimeWindow access, List<TimeWindow> services) OpeningHours(com.google.common.collect.Range<Instant> interval) Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesOpeningHours(Instant hoursBegin, Instant hoursEnd) Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesOpeningHours(Instant hoursBegin, Instant hoursEnd, ZoneId zoneId) Constructor ofOpeningHoursusingInstants.OpeningHours(LocalDateTime hoursBegin, LocalDateTime hoursEnd) Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesOpeningHours(ZonedDateTime hoursBegin, ZonedDateTime hoursEnd) This constructor sets theOpeningHoursfor theINode.OpeningHours(ZonedDateTime accessHoursBegin, ZonedDateTime accessHoursEnd, boolean isSoloAccessHour) OpeningHours(GregorianCalendar hoursBegin, GregorianCalendar hoursEnd) Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributes -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns the hours asWorkingHours(this.getBegin(), this.getEnd(), this.getZoneId())orOpeningHours(this.getBegin(), this.getEnd(), this.getZoneId()).Gets theIDutyHours.DutyHoursFlavour.WOH_FLAVOUR, the default value isenum constant ordinal: 0.booleanvoidsetIsSoloAccessHour(boolean isSoloAccessHour) voidsetServiceHoursOffsets(List<org.apache.commons.lang3.tuple.Pair<Long, Long>> offsets) static IOpeningHourstakeOverProperties(IOpeningHours src, IOpeningHours target) Methods inherited from class com.dna.jopt.member.unit.hours.AbstractDutyHours
compareTo, getTimeWindow, isPrefferedHour, setIsPrefferedHour, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.dna.jopt.member.unit.hours.IDutyHours
getTimeWindow, isPrefferedHour, setIsPrefferedHour
-
Constructor Details
-
OpeningHours
Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
hoursBegin- hoursBeginhoursEnd- hoursEnd
-
OpeningHours
Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
hoursBegin- hoursBeginhoursEnd- hoursEnd
-
OpeningHours
This constructor sets theOpeningHoursfor theINode. The first set of parameters specify when theNodeopens and closes. Giving service to aNodeoutside of theOpeningHourswill trigger aIViolationand will produce additional costs.Example:
private void addNodes() { List<IOpeningHours> weeklyOpeningHours = new ArrayList<IOpeningHours>(); weeklyOpeningHours.add( new OpeningHours( ZonedDateTime.of(2020, MAY.getValue(), 6, 8, 0, 0, 0, ZoneId.of("Europe/Berlin")), ZonedDateTime.of(2020, MAY.getValue(), 6, 17, 0, 0, 0, ZoneId.of("Europe/Berlin")))); weeklyOpeningHours.add( new OpeningHours( ZonedDateTime.of(2020, MAY.getValue(), 7, 8, 0, 0, 0, ZoneId.of("Europe/Berlin")), ZonedDateTime.of(2020, MAY.getValue(), 7, 17, 0, 0, 0, ZoneId.of("Europe/Berlin")))); Duration visitDuration = Duration.ofMinutes(20); // Defining a Node TimeWindowGeoNode aachen = new TimeWindowGeoNode("Aachen", 50.775346, 6.083887, weeklyOpeningHours, visitDuration, 1); this.addElement(aachen); }- Parameters:
hoursBegin- the zonedDateTime when the WorkingHours of the Node startshoursEnd- the zonedDateTime when the WorkingHors of the Node end
-
OpeningHours
-
OpeningHours
-
OpeningHours
-
OpeningHours
public OpeningHours(ZonedDateTime accessHoursBegin, ZonedDateTime accessHoursEnd, boolean isSoloAccessHour) -
OpeningHours
Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
hoursBegin- hoursBeginhoursEnd- hoursEnd
-
OpeningHours
Constructor ofOpeningHoursusingInstants. The first set of parameters specify when theNodeopens and closes. Giving service to aNodeoutside of theOpeningHourswill trigger aIViolationand will produce additional costs.- Parameters:
hoursBegin- the instant begin of the opening hourshoursEnd- the instant end of the opening hourszoneId- the zone ID of the beginning and closing times
-
OpeningHours
Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
interval- interval
-
OpeningHours
Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
hoursBeginMillis- hoursBeginMillishoursEndMillis- hoursEndMillis
-
-
Method Details
-
setServiceHoursOffsets
-
getServiceHoursOffsets
- Specified by:
getServiceHoursOffsetsin interfaceIOpeningHours
-
isSoloAccessHour
public boolean isSoloAccessHour()- Specified by:
isSoloAccessHourin interfaceIOpeningHours
-
setIsSoloAccessHour
public void setIsSoloAccessHour(boolean isSoloAccessHour) -
getFlavour
Description copied from interface:IDutyHoursGets theIDutyHours.DutyHoursFlavour.WOH_FLAVOUR, the default value isenum constant ordinal: 0.- Specified by:
getFlavourin interfaceIDutyHours- Returns:
- the enum constant ordinal
-
takeOverProperties
-
copy
Description copied from interface:IDutyHoursReturns the hours asWorkingHours(this.getBegin(), this.getEnd(), this.getZoneId())orOpeningHours(this.getBegin(), this.getEnd(), this.getZoneId()). Further, properties are copied.- Specified by:
copyin interfaceIDutyHours- Returns:
- a copy of the Workinghours or the Openinghours
-
OpeningHours(ZonedDateTime, ZonedDateTime)with updated attributes