PDPModel extends AbstractModel<PDPObject> implements TickListener { @Override public final boolean register(PDPObject object) { initialized = true; return doRegister(object); }  @Override final boolean register(PDPObject object); abstract ImmutableSet<Parcel> getContents(Container container); abstract double getContentsSize(Container container); abstract double getContainerCapacity(Container container); abstract void pickup(Vehicle vehicle, Parcel parcel, TimeLapse time); abstract void drop(Vehicle vehicle, Parcel parcel, TimeLapse time); abstract void deliver(Vehicle vehicle, Parcel parcel, TimeLapse time); abstract void addParcelIn(Container container, Parcel parcel); abstract Collection<Parcel> getParcels(ParcelState state); abstract Collection<Parcel> getParcels(ParcelState... states); abstract Set<Vehicle> getVehicles(); abstract ParcelState getParcelState(Parcel parcel); abstract VehicleState getVehicleState(Vehicle vehicle); abstract PDPModel.VehicleParcelActionInfo getVehicleActionInfo(
      Vehicle vehicle); abstract EventAPI getEventAPI(); abstract boolean containerContains(Container container, Parcel parcel); abstract TimeWindowPolicy getTimeWindowPolicy(); abstract void service(Vehicle vehicle, Parcel parcel, TimeLapse time);  }
@Test public void register() { final Parcel p = Parcel.builder(new Point(0, 0), new Point(0, 0)) .build(); model.register(p); assertThat(model).isSameAs(p.pdpModel.get()); final TestDepot d = new TestDepot(10); model.register(d); assertThat(model).isSameAs(d.pdpModel.get()); final TestVehicle v = new TestVehicle(); model.register(v); assertThat(model).isSameAs(v.pdpModel.get()); }
@Test(expected = IllegalArgumentException.class) public void registerFail1() { final Parcel p = Parcel.builder(new Point(0, 0), new Point(1, 1)) .build(); model.register(p); model.register(p); }
@Test(expected = IllegalArgumentException.class) public void registerFail2() { final Depot d = new TestDepot(10); model.register(d); model.register(d); }
@Test(expected = IllegalArgumentException.class) public void registerFail3() { final TestVehicle v = new TestVehicle(); model.register(v); model.register(v); }
@Test(expected = IllegalStateException.class) public void containerSetCapacityFail() { final Depot d = new TestDepot(10); model.register(d); rm.register(d); d.setCapacity(20); }
@Test(expected = IllegalStateException.class) public void objectSetStartPositionFail() { final Depot d = new TestDepot(10); model.register(d); assertEquals(model, d.getPDPModel()); rm.register(d); assertEquals(rm, d.getRoadModel()); d.setStartPosition(new Point(0, 0)); }