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
ConstructorDescriptionOpeningHours
(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 ofOpeningHours
usingInstants
.OpeningHours
(LocalDateTime hoursBegin, LocalDateTime hoursEnd) Deprecated.please useOpeningHours(ZonedDateTime, ZonedDateTime)
with updated attributesOpeningHours
(ZonedDateTime hoursBegin, ZonedDateTime hoursEnd) This constructor sets theOpeningHours
for 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
.boolean
void
setIsSoloAccessHour
(boolean isSoloAccessHour) void
setServiceHoursOffsets
(List<org.apache.commons.lang3.tuple.Pair<Long, Long>> offsets) static IOpeningHours
takeOverProperties
(IOpeningHours src, IOpeningHours target) Methods inherited from class com.dna.jopt.member.unit.hours.AbstractDutyHours
compareTo, getTimeWindow, isPrefferedHour, setIsPrefferedHour, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods 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 theOpeningHours
for theINode
. The first set of parameters specify when theNode
opens and closes. Giving service to aNode
outside of theOpeningHours
will trigger aIViolation
and 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 ofOpeningHours
usingInstants
. The first set of parameters specify when theNode
opens and closes. Giving service to aNode
outside of theOpeningHours
will trigger aIViolation
and 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:
getServiceHoursOffsets
in interfaceIOpeningHours
-
isSoloAccessHour
public boolean isSoloAccessHour()- Specified by:
isSoloAccessHour
in interfaceIOpeningHours
-
setIsSoloAccessHour
public void setIsSoloAccessHour(boolean isSoloAccessHour) -
getFlavour
Description copied from interface:IDutyHours
Gets theIDutyHours.DutyHoursFlavour.WOH_FLAVOUR
, the default value isenum constant ordinal: 0
.- Specified by:
getFlavour
in interfaceIDutyHours
- Returns:
- the enum constant ordinal
-
takeOverProperties
-
copy
Description copied from interface:IDutyHours
Returns the hours asWorkingHours(this.getBegin(), this.getEnd(), this.getZoneId())
orOpeningHours(this.getBegin(), this.getEnd(), this.getZoneId())
. Further, properties are copied.- Specified by:
copy
in interfaceIDutyHours
- Returns:
- a copy of the Workinghours or the Openinghours
-
OpeningHours(ZonedDateTime, ZonedDateTime)
with updated attributes