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>

public class OpeningHours extends AbstractDutyHours implements IOpeningHours
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:
  • Constructor Details

    • OpeningHours

      @Deprecated public OpeningHours(GregorianCalendar hoursBegin, GregorianCalendar hoursEnd)
      Deprecated.
      please use OpeningHours(ZonedDateTime, ZonedDateTime) with updated attributes
      Deprecated constructor
      Parameters:
      hoursBegin - hoursBegin
      hoursEnd - hoursEnd
    • OpeningHours

      @Deprecated public OpeningHours(LocalDateTime hoursBegin, LocalDateTime hoursEnd)
      Deprecated.
      please use OpeningHours(ZonedDateTime, ZonedDateTime) with updated attributes
      Deprecated constructor
      Parameters:
      hoursBegin - hoursBegin
      hoursEnd - hoursEnd
    • OpeningHours

      public OpeningHours(ZonedDateTime hoursBegin, ZonedDateTime hoursEnd)
      This constructor sets the OpeningHours for the INode. The first set of parameters specify when the Node opens and closes. Giving service to a Node outside of the OpeningHours will trigger a IViolation 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 starts
      hoursEnd - the zonedDateTime when the WorkingHors of the Node end
    • OpeningHours

      public OpeningHours(TimeWindow window)
    • OpeningHours

      public OpeningHours(TimeWindow access, TimeWindow service)
    • OpeningHours

      public OpeningHours(TimeWindow access, List<TimeWindow> services)
    • OpeningHours

      public OpeningHours(ZonedDateTime accessHoursBegin, ZonedDateTime accessHoursEnd, boolean isSoloAccessHour)
    • OpeningHours

      @Deprecated public OpeningHours(Instant hoursBegin, Instant hoursEnd)
      Deprecated.
      please use OpeningHours(ZonedDateTime, ZonedDateTime) with updated attributes
      Deprecated constructor
      Parameters:
      hoursBegin - hoursBegin
      hoursEnd - hoursEnd
    • OpeningHours

      public OpeningHours(Instant hoursBegin, Instant hoursEnd, ZoneId zoneId)
      Constructor of OpeningHours using Instants. The first set of parameters specify when the Node opens and closes. Giving service to a Node outside of the OpeningHours will trigger a IViolation and 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
    • OpeningHours

      @Deprecated public OpeningHours(com.google.common.collect.Range<Instant> interval)
      Deprecated.
      please use OpeningHours(ZonedDateTime, ZonedDateTime) with updated attributes
      Deprecated constructor
      Parameters:
      interval - interval
    • OpeningHours

      @Deprecated public OpeningHours(long hoursBeginMillis, long hoursEndMillis)
      Deprecated.
      please use OpeningHours(ZonedDateTime, ZonedDateTime) with updated attributes
      Deprecated constructor
      Parameters:
      hoursBeginMillis - hoursBeginMillis
      hoursEndMillis - hoursEndMillis
  • Method Details