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 SummaryNested classes/interfaces inherited from interface com.dna.jopt.member.unit.hours.IDutyHoursIDutyHours.DutyHoursFlavour
- 
Constructor SummaryConstructorsConstructorDescriptionOpeningHours(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 SummaryModifier 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.AbstractDutyHourscompareTo, getTimeWindow, isPrefferedHour, setIsPrefferedHour, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.ComparablecompareToMethods inherited from interface com.dna.jopt.member.unit.hours.IDutyHoursgetTimeWindow, isPrefferedHour, setIsPrefferedHour
- 
Constructor Details- 
OpeningHoursDeprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
- hoursBegin- hoursBegin
- hoursEnd- hoursEnd
 
- 
OpeningHoursDeprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
- hoursBegin- hoursBegin
- hoursEnd- hoursEnd
 
- 
OpeningHoursThis 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 starts
- hoursEnd- the zonedDateTime when the WorkingHors of the Node end
 
- 
OpeningHours
- 
OpeningHours
- 
OpeningHours
- 
OpeningHourspublic OpeningHours(ZonedDateTime accessHoursBegin, ZonedDateTime accessHoursEnd, boolean isSoloAccessHour) 
- 
OpeningHoursDeprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
- hoursBegin- hoursBegin
- hoursEnd- hoursEnd
 
- 
OpeningHoursConstructor 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 hours
- hoursEnd- the instant end of the opening hours
- zoneId- the zone ID of the beginning and closing times
 
- 
OpeningHoursDeprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
- interval- interval
 
- 
OpeningHoursDeprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)with updated attributesDeprecated constructor- Parameters:
- hoursBeginMillis- hoursBeginMillis
- hoursEndMillis- hoursEndMillis
 
 
- 
- 
Method Details- 
setServiceHoursOffsets
- 
getServiceHoursOffsets- Specified by:
- getServiceHoursOffsetsin interface- IOpeningHours
 
- 
isSoloAccessHourpublic boolean isSoloAccessHour()- Specified by:
- isSoloAccessHourin interface- IOpeningHours
 
- 
setIsSoloAccessHourpublic void setIsSoloAccessHour(boolean isSoloAccessHour) 
- 
getFlavourDescription copied from interface:IDutyHoursGets theIDutyHours.DutyHoursFlavour.WOH_FLAVOUR, the default value isenum constant ordinal: 0.- Specified by:
- getFlavourin interface- IDutyHours
- Returns:
- the enum constant ordinal
 
- 
takeOverProperties
- 
copyDescription 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 interface- IDutyHours
- Returns:
- a copy of the Workinghours or the Openinghours
 
 
- 
OpeningHours(ZonedDateTime, ZonedDateTime)with updated attributes