Record Class RouteSpec

java.lang.Object
java.lang.Record
com.graphhopper.jsprit.core.problem.solution.spec.RouteSpec
Record Components:
vehicleId - the ID of the vehicle for this route
activities - the ordered list of activities in this route

public record RouteSpec(String vehicleId, List<ActivitySpec> activities) extends Record
Specifies one route in a solution.

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

  • Constructor Details

    • RouteSpec

      public RouteSpec(String vehicleId, List<ActivitySpec> activities)
      Creates an instance of a RouteSpec record class.
      Parameters:
      vehicleId - the value for the vehicleId record component
      activities - the value for the activities record component
  • Method Details

    • of

      public static RouteSpec of(String vehicleId, ActivitySpec... activities)
      Creates a route spec with the given activities.
    • of

      public static RouteSpec of(String vehicleId, List<ActivitySpec> activities)
      Creates a route spec with the given activities.
    • from

      public static RouteSpec from(VehicleRoute route)
      Extracts a route spec from an existing route.
      Parameters:
      route - the route to extract from
      Returns:
      a spec representing the route's structure
    • 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.
    • vehicleId

      public String vehicleId()
      Returns the value of the vehicleId record component.
      Returns:
      the value of the vehicleId record component
    • activities

      public List<ActivitySpec> activities()
      Returns the value of the activities record component.
      Returns:
      the value of the activities record component