@Override public boolean containerContains(Container container, Parcel parcel) { return delegate.containerContains(container, parcel); }
final boolean inCargo = pm.containerContains(this, curr.get());
final boolean inCargo = pm.containerContains(this, curr.get());
if (pm.get().containerContains(this, target.get())) { if (rm.get().getPosition(this) .equals(target.get().getDeliveryLocation())) {
if (type == DestType.DELIVERY) { checkArgument( pdpModel.get().containerContains((Vehicle) object, (Parcel) destinationRoadUser), "A vehicle can only move to the delivery location of a parcel if it"
if (type == DestType.DELIVERY) { checkArgument( pdpModel.get().containerContains((Vehicle) object, (Parcel) destinationRoadUser), "A vehicle can only move to the delivery location of a parcel if it"
Parcel closest = null; for (final Parcel p : parcels) { final Point pos = pdpModel.containerContains(vehicle, p) ? p .getDeliveryLocation() : roadModel.getPosition(p); final double d = Point.distance(roadModel.getPosition(vehicle), pos);
/** * Check whether mixing diversion allowed/disallowed methods produce the * expected results. */ @Test public void test() { // first move by using the location rm.moveTo(dv1, dp1.getPickupLocation(), time(10)); assertEquals(rm.getPosition(dv1), dp1.getPickupLocation()); pm.pickup(dv1, dp1, time(1)); assertTrue(pm.containerContains(dv1, dp1)); // now move by using the reference to the parcel rm.moveTo(dv1, dp1, time(300)); assertEquals(rm.getPosition(dv1), dp1.getDeliveryLocation()); } }
/** * Check whether diversion within a route before delivery is correctly handled * depending on the configuration. */ @Test public void divertToOtherBeforeDelivery() { boolean success = true; try { rm.moveTo(dv1, dp1, time(10)); assertEquals(rm.getPosition(dv1), rm.getPosition(dp1)); pm.pickup(dv1, dp1, time(10)); assertTrue(pm.containerContains(dv1, dp1)); rm.moveTo(dv1, dp1, time(1)); rm.moveTo(dv1, dp2, time(80)); } catch (final IllegalArgumentException e) { success = false; } assertEquals(allowDiversion, success); }
assertTrue(model.containerContains(truck, pack1)); assertEquals(2, model.getContentsSize(truck), EPSILON); assertTrue(model.getContents(truck).contains(pack1));