Class Service.Builder<T extends Service>

java.lang.Object
com.graphhopper.jsprit.core.problem.job.Service.Builder<T>
Direct Known Subclasses:
Break.Builder, Delivery.Builder, EnRouteDelivery.Builder, EnRoutePickup.Builder, Pickup.Builder
Enclosing class:
Service

public static class Service.Builder<T extends Service> extends Object
Builder that builds a service.
Author:
schroeder
  • Field Details

    • locationId

      protected String locationId
    • coord

      protected Coordinate coord
    • serviceTime

      protected double serviceTime
    • capacityBuilder

      protected Capacity.Builder capacityBuilder
    • capacity

      protected Capacity capacity
    • skillBuilder

      protected Skills.Builder skillBuilder
    • skills

      protected Skills skills
    • location

      protected Location location
    • timeWindows

      protected TimeWindowsImpl timeWindows
    • userData

      protected Object userData
    • maxTimeInVehicle

      protected double maxTimeInVehicle
    • activity

      protected Activity activity
  • Method Details

    • newInstance

      public static Service.Builder newInstance(String id)
      Returns a new instance of builder that builds a service.
      Parameters:
      id - the id of the service
      Returns:
      the builder
    • setType

      protected Service.Builder<T> setType(String name)
      Protected method to set the type-name of the service.

      Currently there are Service, Pickup and Delivery.

      Parameters:
      name - the name of service
      Returns:
      the builder
    • setLocation

      public Service.Builder<T> setLocation(Location location)
      Sets location
      Parameters:
      location - location
      Returns:
      builder
    • setServiceTime

      public Service.Builder<T> setServiceTime(double serviceTime)
      Sets the serviceTime of this service.

      It is understood as time that a service or its implied activity takes at the service-location, for instance to unload goods.

      Parameters:
      serviceTime - the service time / duration of service to be set
      Returns:
      builder
      Throws:
      IllegalArgumentException - if serviceTime invalid input: '<' 0
    • setUserData

      public Service.Builder<T> setUserData(Object userData)
      Sets user specific domain data associated with the object.

      The user data is a black box for the framework, it only stores it, but never interacts with it in any way.

      Parameters:
      userData - any object holding the domain specific user data associated with the object.
      Returns:
      builder
    • addSizeDimension

      public Service.Builder<T> addSizeDimension(int dimensionIndex, int dimensionValue)
      Adds capacity dimension.
      Parameters:
      dimensionIndex - the dimension index of the capacity value
      dimensionValue - the capacity value
      Returns:
      the builder
      Throws:
      IllegalArgumentException - if dimensionValue invalid input: '<' 0
    • setTimeWindow

      public Service.Builder<T> setTimeWindow(TimeWindow tw)
    • addTimeWindow

      public Service.Builder<T> addTimeWindow(TimeWindow timeWindow)
    • addTimeWindow

      public Service.Builder<T> addTimeWindow(double earliest, double latest)
    • addAllTimeWindows

      public Service.Builder<T> addAllTimeWindows(Collection<TimeWindow> timeWindows)
    • build

      public T build()
      Builds the service.
      Returns:
      Service
      Throws:
      IllegalArgumentException - if neither locationId nor coordinate is set.
    • addRequiredSkill

      public Service.Builder<T> addRequiredSkill(String skill)
    • setName

      public Service.Builder<T> setName(String name)
    • addAllRequiredSkills

      public Service.Builder<T> addAllRequiredSkills(Collection<String> skills)
    • addAllRequiredSkills

      public Service.Builder<T> addAllRequiredSkills(Skills skills)
    • addAllSizeDimensions

      public Service.Builder<T> addAllSizeDimensions(Capacity size)
    • setPriority

      public Service.Builder<T> setPriority(int priority)
      Set priority to service. Only 1 (very high) to 10 (very low) are allowed.

      Default is 2.

      Parameters:
      priority -
      Returns:
      builder
    • setMaxTimeInVehicle

      public Service.Builder<T> setMaxTimeInVehicle(double maxTimeInVehicle)