Record Class ActivitySpec

java.lang.Object
java.lang.Record
com.graphhopper.jsprit.core.problem.solution.spec.ActivitySpec
Record Components:
jobId - the ID of the job this activity belongs to
type - which activity of the job (VISIT for single-stop, PICKUP/DELIVERY for shipments)
options - optional overrides (null = use defaults)

public record ActivitySpec(String jobId, ActivityType type, ActivityOptions options) extends Record
Specifies one activity in a route.

This is pure data - no actual Activity objects are referenced. The spec is materialized into real activities when building the solution.

  • Constructor Details

    • ActivitySpec

      public ActivitySpec(String jobId, ActivityType type, ActivityOptions options)
      Creates an instance of a ActivitySpec record class.
      Parameters:
      jobId - the value for the jobId record component
      type - the value for the type record component
      options - the value for the options record component
  • Method Details

    • of

      public static ActivitySpec of(String jobId, ActivityType type)
      Creates an activity spec with default options.
    • visit

      public static ActivitySpec visit(String jobId)
      Creates a VISIT activity spec (for single-stop jobs).
    • pickup

      public static ActivitySpec pickup(String jobId)
      Creates a PICKUP activity spec (for shipments).
    • delivery

      public static ActivitySpec delivery(String jobId)
      Creates a DELIVERY activity spec (for shipments).
    • from

      public static ActivitySpec from(TourActivity.JobActivity activity)
      Extracts an activity spec from an existing job activity.
      Parameters:
      activity - the job activity to extract from
      Returns:
      a spec representing the activity
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • jobId

      public String jobId()
      Returns the value of the jobId record component.
      Returns:
      the value of the jobId record component
    • type

      public ActivityType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • options

      public ActivityOptions options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component