/** * @return The start position of the vehicle. */ public final Point getStartPosition() { return dto.getStartPosition(); } }
public Point getDepotLocation() { return vehicle.getDto().getStartPosition(); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof VehicleDTO) { VehicleDTO that = (VehicleDTO) o; return (this.startPosition.equals(that.getStartPosition())) && (Double.doubleToLongBits(this.speed) == Double.doubleToLongBits(that.getSpeed())) && (this.capacity == that.getCapacity()) && (this.availabilityTimeWindow.equals(that.getAvailabilityTimeWindow())); } return false; }
@Override public JsonElement doSerialize(VehicleDTO src, Type typeOfSrc, JsonSerializationContext context) { final JsonArray arr = new JsonArray(); arr.add( context.serialize(src.getAvailabilityTimeWindow(), TimeWindow.class)); arr.add(context.serialize(src.getCapacity())); arr.add(context.serialize(src.getSpeed())); arr.add(context.serialize(src.getStartPosition())); return arr; } }
@Override public JsonElement doSerialize(VehicleDTO src, Type typeOfSrc, JsonSerializationContext context) { final JsonArray arr = new JsonArray(); arr.add( context.serialize(src.getAvailabilityTimeWindow(), TimeWindow.class)); arr.add(context.serialize(src.getCapacity())); arr.add(context.serialize(src.getSpeed())); arr.add(context.serialize(src.getStartPosition())); return arr; } }
/** * Instantiate a new vehicle based on the specified properties. * @param vehicleDto The data transfer object that holds all vehicle * properties. */ protected Vehicle(VehicleDTO vehicleDto) { dto = vehicleDto; setStartPosition(dto.getStartPosition()); setCapacity(dto.getCapacity()); }
/** * Copy the value of the specified vehicle into this builder. * @param dto The dto to copy values from. * @return This, as per the builder pattern. */ public Builder use(VehicleDTO dto) { return startPosition(dto.getStartPosition()) .availabilityTimeWindow(dto.getAvailabilityTimeWindow()) .speed(dto.getSpeed()) .capacity(dto.getCapacity()); }
points.add(v.getDto().getStartPosition());
snapshot.getPathTo(vehicleLocation, vso.getDto().getStartPosition(), state.getTimeUnit(), maxSpeed, heuristic);
void checkVehicles(List<? extends TestVehicle> expected, ImmutableList<VehicleStateObject> states) { assertEquals(expected.size(), states.size()); for (int i = 0; i < expected.size(); i++) { final TestVehicle vehicle = expected.get(i); final VehicleDTO dto = vehicle.dto; final VehicleStateObject vs = states.get(i); assertEquals(dto.getAvailabilityTimeWindow(), vs.getDto().getAvailabilityTimeWindow()); assertEquals(dto.getCapacity(), vs.getDto().getCapacity()); assertEquals(dto.getSpeed(), vs.getDto().getSpeed(), 0); assertEquals(dto.getStartPosition(), vs.getDto().getStartPosition()); assertEquals(rm.getPosition(expected.get(i)), vs.getLocation()); final Parcel dest = rm.getDestinationToParcel(vehicle); if (dest == null) { assertFalse(vs.getDestination().isPresent()); } else { assertEquals(dest, vs.getDestination().get()); } if (pm.getVehicleState(vehicle) == VehicleState.IDLE) { assertEquals(0, vs.getRemainingServiceTime()); } else { assertEquals(pm.getVehicleActionInfo(vehicle).timeNeeded(), vs.getRemainingServiceTime()); } } }
dv2 = new TestVehicle(new Point(0, 0)); for (final Vehicle tv : asList(dv1, dv2)) { rm.addObjectAt(tv, tv.getDTO().getStartPosition()); pm.register(tv);