Class RouteChangedEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.springframework.context.ApplicationEvent
-
- org.optaweb.vehiclerouting.service.route.RouteChangedEvent
-
- All Implemented Interfaces:
Serializable
public class RouteChangedEvent extends org.springframework.context.ApplicationEventEvent published when the routing plan has been updated either by discovering a better route or by a change in the problem specification (vehicles, visits).- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description RouteChangedEvent(Object source, Distance distance, List<Long> vehicleIds, Long depotId, List<Long> visitIds, Collection<ShallowRoute> routes)Create a new ApplicationEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Long>depotId()The depot ID.Distancedistance()Routing plan distance.Collection<ShallowRoute>routes()Routes of all vehicles.List<Long>vehicleIds()IDs of all vehicles.List<Long>visitIds()-
Methods inherited from class java.util.EventObject
getSource, toString
-
-
-
-
Constructor Detail
-
RouteChangedEvent
public RouteChangedEvent(Object source, Distance distance, List<Long> vehicleIds, Long depotId, List<Long> visitIds, Collection<ShallowRoute> routes)
Create a new ApplicationEvent.- Parameters:
source- the object on which the event initially occurred (nevernull)distance- total distance of all vehicle routesvehicleIds- vehicle IDsdepotId- depot ID (may benullif there are no locations)visitIds- IDs of visitsroutes- vehicle routes
-
-
Method Detail
-
routes
public Collection<ShallowRoute> routes()
Routes of all vehicles.- Returns:
- vehicle routes
-
distance
public Distance distance()
Routing plan distance.- Returns:
- distance (never
null)
-
-