Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Jan 5, 2024
1 parent 182f281 commit d58be90
Showing 1 changed file with 33 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public LSPTourEndEventHandler(
@Override
public void reset(int iteration) {
// TODO Auto-generated method stub

}

@Override
Expand All @@ -125,7 +124,7 @@ public void handleEvent(CarrierTourEndEvent event) {
}
}


// ex Collection run
private void logUnload(CarrierTourEndEvent event, Tour tour) {
ShipmentUtils.LoggedShipmentUnloadBuilder builder =
ShipmentUtils.LoggedShipmentUnloadBuilder.newInstance();
Expand All @@ -144,7 +143,7 @@ private void logUnload(CarrierTourEndEvent event, Tour tour) {
lspShipment.getShipmentLog().addPlanElement(unloadId, unload);
}


// ex Collection run
private void logTransport(CarrierTourEndEvent event, Tour tour) {
String idString = resource.getId() + "" + logisticChainElement.getId() + "TRANSPORT";
Id<ShipmentPlanElement> id = Id.create(idString, ShipmentPlanElement.class);
Expand All @@ -156,6 +155,37 @@ private void logTransport(CarrierTourEndEvent event, Tour tour) {
}
}

// Ex Main Run //
private void logUnload(CarrierTourEndEvent event) {
ShipmentUtils.LoggedShipmentUnloadBuilder builder =
ShipmentUtils.LoggedShipmentUnloadBuilder.newInstance();
builder.setStartTime(event.getTime() - getTotalUnloadingTime(tour));
builder.setEndTime(event.getTime());
builder.setLogisticChainElement(logisticChainElement);
builder.setResourceId(resource.getId());
builder.setCarrierId(event.getCarrierId());
ShipmentPlanElement unload = builder.build();
String idString =
unload.getResourceId()
+ ""
+ unload.getLogisticChainElement().getId()
+ unload.getElementType();
Id<ShipmentPlanElement> unloadId = Id.create(idString, ShipmentPlanElement.class);
lspShipment.getShipmentLog().addPlanElement(unloadId, unload);
}

// Ex Main Run //
private void logTransport(CarrierTourEndEvent event) {
String idString = resource.getId() + "" + logisticChainElement.getId() + "TRANSPORT";
Id<ShipmentPlanElement> id = Id.create(idString, ShipmentPlanElement.class);
ShipmentPlanElement abstractPlanElement =
lspShipment.getShipmentLog().getPlanElements().get(id);
if (abstractPlanElement instanceof ShipmentLeg transport) {
transport.setEndTime(event.getTime() - getTotalUnloadingTime(tour));
transport.setToLinkId(event.getLinkId());
}
}

private double getTotalUnloadingTime(Tour tour) {
double totalTime = 0;
for (TourElement element : tour.getTourElements()) {
Expand Down Expand Up @@ -193,36 +223,7 @@ public void notifyAfterMobsim(AfterMobsimEvent event) {}

// ***** (Begin) Ex MainRun *** //

// Ex Main Run //
private void logUnload(CarrierTourEndEvent event) {
ShipmentUtils.LoggedShipmentUnloadBuilder builder =
ShipmentUtils.LoggedShipmentUnloadBuilder.newInstance();
builder.setStartTime(event.getTime() - getTotalUnloadingTime(tour));
builder.setEndTime(event.getTime());
builder.setLogisticChainElement(logisticChainElement);
builder.setResourceId(resource.getId());
builder.setCarrierId(event.getCarrierId());
ShipmentPlanElement unload = builder.build();
String idString =
unload.getResourceId()
+ ""
+ unload.getLogisticChainElement().getId()
+ unload.getElementType();
Id<ShipmentPlanElement> unloadId = Id.create(idString, ShipmentPlanElement.class);
lspShipment.getShipmentLog().addPlanElement(unloadId, unload);
}

// Ex Main Run //
private void logTransport(CarrierTourEndEvent event) {
String idString = resource.getId() + "" + logisticChainElement.getId() + "TRANSPORT";
Id<ShipmentPlanElement> id = Id.create(idString, ShipmentPlanElement.class);
ShipmentPlanElement abstractPlanElement =
lspShipment.getShipmentLog().getPlanElements().get(id);
if (abstractPlanElement instanceof ShipmentLeg transport) {
transport.setEndTime(event.getTime() - getTotalUnloadingTime(tour));
transport.setToLinkId(event.getLinkId());
}
}



Expand Down

0 comments on commit d58be90

Please sign in to comment.