/** * Constructs a new {@link GlobalStateObject} using the routes specified. * @param routes The routes to use, this will replace any existing routes in * the vehicles. Exactly one route must be specified for each * vehicle. * @return A newly constructed {@link GlobalStateObject} that only differs * from the current object in the vehicles' routes. */ public GlobalStateObject withRoutes( ImmutableList<ImmutableList<Parcel>> routes) { checkArgument(routes.size() == getVehicles().size()); final ImmutableList.Builder<VehicleStateObject> b = ImmutableList.builder(); for (int i = 0; i < getVehicles().size(); i++) { b.add(getVehicles().get(i).withRoute(routes.get(i))); } return create(getAvailableParcels(), b.build(), getTime(), getTimeUnit(), getSpeedUnit(), getDistUnit(), getRoadModelSnapshot()); }
/** * Constructs a new {@link GlobalStateObject} with only the selected vehicle. * The current instance remains unchanged. * @param index The index of the vehicle to select. * @return A new object containing only the selected vehicle, all other values * are copied from this instance. */ public GlobalStateObject withSingleVehicle(int index) { checkArgument(index >= 0 && index < getVehicles().size(), "Invalid vehicle index (%s) must be >= 0 and < %s.", index, getVehicles().size()); return create(getAvailableParcels(), ImmutableList.of(getVehicles().get(index)), getTime(), getTimeUnit(), getSpeedUnit(), getDistUnit(), getRoadModelSnapshot()); }
state.getTimeUnit(), state.getDistUnit(), state.getSpeedUnit());
@CheckReturnValue public static PDPSolution convert(GlobalStateObject state) { checkArgument(state.getTimeUnit().equals(TIME_UNIT)); checkArgument(state.getSpeedUnit().equals(SPEED_UNIT)); checkArgument(state.getDistUnit().equals(DISTANCE_UNIT));
state.getTime(), state.getTimeUnit(), state.getSpeedUnit(), state.getDistUnit(), state.getRoadModelSnapshot());
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof GlobalStateObject) { GlobalStateObject that = (GlobalStateObject) o; return (this.availableParcels.equals(that.getAvailableParcels())) && (this.vehicles.equals(that.getVehicles())) && (this.time == that.getTime()) && (this.timeUnit.equals(that.getTimeUnit())) && (this.speedUnit.equals(that.getSpeedUnit())) && (this.distUnit.equals(that.getDistUnit())) && (this.roadModelSnapshot.equals(that.getRoadModelSnapshot())); } return false; }
state.getSpeedUnit());
final Measure<Double, Velocity> speed = Measure.valueOf( cur.getDto().getSpeed(), state.getSpeedUnit());
Point vehicleLocation = vso.getLocation(); final Measure<Double, Velocity> maxSpeed = Measure.valueOf(vso.getDto().getSpeed(), state.getSpeedUnit());