void checkCurrentParcelOwnership() { checkState( !getPDPModel().getParcelState(route.peek()).isTransitionState(), "Parcel is already being serviced by another vehicle. Parcel state: %s", getPDPModel().getParcelState(route.peek())); }
void checkCurrentParcelOwnership() { checkState( !getPDPModel().getParcelState(route.peek()).isTransitionState(), "Parcel is already being serviced by another vehicle. Parcel state: %s", getPDPModel().getParcelState(route.peek())); }
boolean isPickingUp(Parcel p) { return getPDPModel().getVehicleState(this) == VehicleState.PICKING_UP && getPDPModel().getVehicleActionInfo(this).getParcel().equals(p); }
boolean isPickingUp(Parcel p) { return getPDPModel().getVehicleState(this) == VehicleState.PICKING_UP && getPDPModel().getVehicleActionInfo(this).getParcel().equals(p); }
final ParcelState state = getPDPModel().getParcelState(dp); checkArgument( !state.isDelivered(), if (state == ParcelState.PICKING_UP) { checkArgument( getPDPModel().getVehicleState(this) == VehicleState.PICKING_UP, "When a parcel in the route is in PICKING UP state the vehicle " + "must also be in that state, route: %s.", adjustedRoute, getPDPModel().getVehicleState(this)); } else { checkArgument( getPDPModel().getVehicleState(this) == VehicleState.DELIVERING, "When a parcel in the route is in DELIVERING state the vehicle" + " must also be in that state."); getPDPModel().getVehicleActionInfo(this).getParcel() == dp, "A parcel in the route that is being serviced should be serviced by" + " this truck. This truck is servicing %s.", getPDPModel().getVehicleActionInfo(this).getParcel()); checkArgument(getPDPModel().getContents(this).contains(dp), "A parcel that is in cargo state must be in cargo of this " + "vehicle.");
final ParcelState state = getPDPModel().getParcelState(dp); checkArgument( !state.isDelivered(), if (state == ParcelState.PICKING_UP) { checkArgument( getPDPModel().getVehicleState(this) == VehicleState.PICKING_UP, "When a parcel in the route is in PICKING UP state the vehicle " + "must also be in that state, route: %s.", adjustedRoute, getPDPModel().getVehicleState(this)); } else { checkArgument( getPDPModel().getVehicleState(this) == VehicleState.DELIVERING, "When a parcel in the route is in DELIVERING state the vehicle" + " must also be in that state."); getPDPModel().getVehicleActionInfo(this).getParcel() == dp, "A parcel in the route that is being serviced should be serviced by" + " this truck. This truck is servicing %s.", getPDPModel().getVehicleActionInfo(this).getParcel()); checkArgument(getPDPModel().getContents(this).contains(dp), "A parcel that is in cargo state must be in cargo of this " + "vehicle.");
final ParcelState parcelState = getPDPModel().getParcelState(p); checkArgument( !parcelState.isTransitionState() && !parcelState.isDelivered(), "Parcel state may not be a transition state nor may it be delivered, " + "it is %s.", parcelState, parcelState.isTransitionState() ? getPDPModel() .getVehicleActionInfo(this).timeNeeded() : null); final boolean isPickup = !parcelState.isPickedUp();
final ParcelState parcelState = getPDPModel().getParcelState(p); checkArgument( !parcelState.isTransitionState() && !parcelState.isDelivered(), "Parcel state may not be a transition state nor may it be delivered, " + "it is %s.", parcelState, parcelState.isTransitionState() ? getPDPModel() .getVehicleActionInfo(this).timeNeeded() : null); final boolean isPickup = !parcelState.isPickedUp();