@Override public long getOrderAnnounceTime() { return dto.getOrderAnnounceTime(); }
/** * Creates a new {@link AddParcelEvent}. * @param dto The {@link ParcelDTO} that describes the parcel. * @return A new instance. */ public static AddParcelEvent create(ParcelDTO dto) { return new AutoValue_AddParcelEvent(dto.getOrderAnnounceTime(), dto); }
/** * Creates a new {@link AddParcelEvent}. * @param dto The {@link ParcelDTO} that describes the parcel. * @return A new instance. */ public static AddParcelEvent create(ParcelDTO dto) { return new AutoValue_AddParcelEvent(dto.getOrderAnnounceTime(), dto); }
static ImmutableList<Long> getOrderArrivalTimes(Scenario s) { final ImmutableList.Builder<Long> builder = ImmutableList.builder(); for (final TimedEvent se : s.getEvents()) { if (se instanceof AddParcelEvent) { builder .add(((AddParcelEvent) se).getParcelDTO().getOrderAnnounceTime()); } } return builder.build(); }
@Override public JsonElement doSerialize(ParcelDTO src, Type typeOfSrc, JsonSerializationContext context) { final JsonArray arr = new JsonArray(); arr.add(context.serialize(src.getPickupLocation())); arr.add(context.serialize(src.getDeliveryLocation())); arr.add(context.serialize(src.getPickupTimeWindow(), TimeWindow.class)); arr.add( context.serialize(src.getDeliveryTimeWindow(), TimeWindow.class)); arr.add(context.serialize(src.getNeededCapacity())); arr.add(context.serialize(src.getOrderAnnounceTime())); arr.add(context.serialize(src.getPickupDuration())); arr.add(context.serialize(src.getDeliveryDuration())); return arr; } }
@Override public JsonElement doSerialize(ParcelDTO src, Type typeOfSrc, JsonSerializationContext context) { final JsonArray arr = new JsonArray(); arr.add(context.serialize(src.getPickupLocation())); arr.add(context.serialize(src.getDeliveryLocation())); arr.add(context.serialize(src.getPickupTimeWindow(), TimeWindow.class)); arr.add( context.serialize(src.getDeliveryTimeWindow(), TimeWindow.class)); arr.add(context.serialize(src.getNeededCapacity())); arr.add(context.serialize(src.getOrderAnnounceTime())); arr.add(context.serialize(src.getPickupDuration())); arr.add(context.serialize(src.getDeliveryDuration())); return arr; } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof ParcelDTO) { ParcelDTO that = (ParcelDTO) o; return (this.pickupLocation.equals(that.getPickupLocation())) && (this.deliveryLocation.equals(that.getDeliveryLocation())) && (this.pickupTimeWindow.equals(that.getPickupTimeWindow())) && (this.deliveryTimeWindow.equals(that.getDeliveryTimeWindow())) && (Double.doubleToLongBits(this.neededCapacity) == Double.doubleToLongBits(that.getNeededCapacity())) && (this.orderAnnounceTime == that.getOrderAnnounceTime()) && (this.pickupDuration == that.getPickupDuration()) && (this.deliveryDuration == that.getDeliveryDuration()); } return false; }
Builder(ParcelDTO dto) { pickupLocation = dto.getPickupLocation(); deliveryLocation = dto.getDeliveryLocation(); pickupTimeWindow = dto.getPickupTimeWindow(); deliveryTimeWindow = dto.getDeliveryTimeWindow(); neededCapacity = dto.getNeededCapacity(); orderAnnounceTime = dto.getOrderAnnounceTime(); pickupDuration = dto.getPickupDuration(); deliveryDuration = dto.getDeliveryDuration(); toString = null; }