}
return;
}
// Otherwise, Check if we can pickup nearby
final DefaultParcel closest = (DefaultParcel) RoadModels.findClosestObject(
rm.getPosition(this), rm, new Predicate<RoadUser>() {
@Override
public boolean apply(RoadUser input) {
return input instanceof DefaultParcel
&& pm.getParcelState(((DefaultParcel) input)) == ParcelState.AVAILABLE;
}
});
if (closest != null
&& Point.distance(rm.getPosition(closest), getPosition()) < 10) {
if (rm.equalPosition(closest, this)
&& pm.getTimeWindowPolicy().canPickup(closest.getPickupTimeWindow(),
time.getTime(), closest.getPickupDuration())) {
final double newSize = getPDPModel().getContentsSize(this)
+ closest.getMagnitude();
if (newSize <= getCapacity()) {
pm.pickup(this, closest, time);
}
} else {