diff --git a/matsim/src/main/java/org/matsim/core/events/EventsReaderXMLv1.java b/matsim/src/main/java/org/matsim/core/events/EventsReaderXMLv1.java
index 16a70f3946d..dc5bc26a03a 100644
--- a/matsim/src/main/java/org/matsim/core/events/EventsReaderXMLv1.java
+++ b/matsim/src/main/java/org/matsim/core/events/EventsReaderXMLv1.java
@@ -101,25 +101,25 @@ private void startEvent(final Attributes atts) {
// === material related to wait2link below here ===
if (LinkLeaveEvent.EVENT_TYPE.equals(eventType)) {
- this.events.processEvent(new LinkLeaveEvent(time,
- Id.create(atts.getValue(LinkLeaveEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
+ this.events.processEvent(new LinkLeaveEvent(time,
+ Id.create(atts.getValue(LinkLeaveEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
Id.create(atts.getValue(LinkLeaveEvent.ATTRIBUTE_LINK), Link.class)
// had driver id in previous version
));
} else if (LinkEnterEvent.EVENT_TYPE.equals(eventType)) {
- this.events.processEvent(new LinkEnterEvent(time,
- Id.create(atts.getValue(LinkEnterEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
+ this.events.processEvent(new LinkEnterEvent(time,
+ Id.create(atts.getValue(LinkEnterEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
Id.create(atts.getValue(LinkEnterEvent.ATTRIBUTE_LINK), Link.class)
// had driver id in previous version
));
} else if (VehicleEntersTrafficEvent.EVENT_TYPE.equals(eventType) ) {
// (this is the new version, marked by the new events name)
- this.events.processEvent(new VehicleEntersTrafficEvent(time,
+ this.events.processEvent(new VehicleEntersTrafficEvent(time,
Id.create(atts.getValue(HasPersonId.ATTRIBUTE_PERSON), Person.class),
- Id.create(atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_LINK), Link.class),
+ Id.create(atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_LINK), Link.class),
Id.create(atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
- atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_NETWORKMODE),
+ atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_NETWORKMODE),
Double.parseDouble( atts.getValue( VehicleEntersTrafficEvent.ATTRIBUTE_POSITION) )
));
} else if ( "wait2link".equals(eventType) ) {
@@ -140,19 +140,19 @@ private void startEvent(final Attributes atts) {
} else {
position = 1.0 ;
}
- this.events.processEvent(new VehicleEntersTrafficEvent(time,
+ this.events.processEvent(new VehicleEntersTrafficEvent(time,
Id.create(atts.getValue(HasPersonId.ATTRIBUTE_PERSON), Person.class),
- Id.create(atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_LINK), Link.class),
+ Id.create(atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_LINK), Link.class),
vehicleId,
- atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_NETWORKMODE),
+ atts.getValue(VehicleEntersTrafficEvent.ATTRIBUTE_NETWORKMODE),
position
));
} else if (VehicleLeavesTrafficEvent.EVENT_TYPE.equals(eventType)) {
- this.events.processEvent(new VehicleLeavesTrafficEvent(time,
- Id.create(atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_DRIVER), Person.class),
- Id.create(atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_LINK), Link.class),
- atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_VEHICLE) == null ? null : Id.create(atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
- atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_NETWORKMODE),
+ this.events.processEvent(new VehicleLeavesTrafficEvent(time,
+ Id.create(atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_DRIVER), Person.class),
+ Id.create(atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_LINK), Link.class),
+ atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_VEHICLE) == null ? null : Id.create(atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_VEHICLE), Vehicle.class),
+ atts.getValue(VehicleLeavesTrafficEvent.ATTRIBUTE_NETWORKMODE),
Double.parseDouble( atts.getValue( VehicleLeavesTrafficEvent.ATTRIBUTE_POSITION) )
));
}
@@ -165,7 +165,7 @@ else if (ActivityEndEvent.EVENT_TYPE.equals(eventType)) {
coord = new Coord( xx, yy ) ;
}
this.events.processEvent(new ActivityEndEvent(
- time,
+ time,
Id.create(atts.getValue(HasPersonId.ATTRIBUTE_PERSON), Person.class),
Id.create(atts.getValue(HasLinkId.ATTRIBUTE_LINK), Link.class),
atts.getValue(HasFacilityId.ATTRIBUTE_FACILITY) == null ? null : Id.create(atts.getValue(HasFacilityId.ATTRIBUTE_FACILITY),
@@ -208,7 +208,7 @@ else if (ActivityEndEvent.EVENT_TYPE.equals(eventType)) {
Id linkId = linkIdString == null ? null : Id.create(linkIdString, Link.class);
this.events.processEvent(new VehicleAbortsEvent(time, Id.create(atts.getValue(VehicleAbortsEvent.ATTRIBUTE_VEHICLE), Vehicle.class), linkId));
} else if (PersonMoneyEvent.EVENT_TYPE.equals(eventType) || "agentMoney".equals(eventType)) {
- this.events.processEvent(new PersonMoneyEvent(time, Id.create(atts.getValue(PersonMoneyEvent.ATTRIBUTE_PERSON), Person.class), Double.parseDouble(atts.getValue(PersonMoneyEvent.ATTRIBUTE_AMOUNT)), atts.getValue(PersonMoneyEvent.ATTRIBUTE_PURPOSE), atts.getValue(PersonMoneyEvent.ATTRIBUTE_TRANSACTION_PARTNER)));
+ this.events.processEvent(new PersonMoneyEvent(time, Id.create(atts.getValue(PersonMoneyEvent.ATTRIBUTE_PERSON), Person.class), Double.parseDouble(atts.getValue(PersonMoneyEvent.ATTRIBUTE_AMOUNT)), atts.getValue(PersonMoneyEvent.ATTRIBUTE_PURPOSE), atts.getValue(PersonMoneyEvent.ATTRIBUTE_TRANSACTION_PARTNER), atts.getValue(PersonMoneyEvent.ATTRIBUTE_REFERENCE)));
} else if (PersonScoreEvent.EVENT_TYPE.equals(eventType) || "personScore".equals(eventType)) {
this.events.processEvent(new PersonScoreEvent(time, Id.create(atts.getValue(PersonScoreEvent.ATTRIBUTE_PERSON), Person.class), Double.parseDouble(atts.getValue(PersonScoreEvent.ATTRIBUTE_AMOUNT)), atts.getValue(PersonScoreEvent.ATTRIBUTE_KIND)));
} else if (PersonEntersVehicleEvent.EVENT_TYPE.equals(eventType)) {
diff --git a/matsim/src/test/java/org/matsim/core/events/EventsReadersTest.java b/matsim/src/test/java/org/matsim/core/events/EventsReadersTest.java
index 3bbf1a1626a..6d2eee9d564 100644
--- a/matsim/src/test/java/org/matsim/core/events/EventsReadersTest.java
+++ b/matsim/src/test/java/org/matsim/core/events/EventsReadersTest.java
@@ -29,22 +29,9 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.matsim.api.core.v01.Id;
-import org.matsim.api.core.v01.events.ActivityEndEvent;
-import org.matsim.api.core.v01.events.ActivityStartEvent;
-import org.matsim.api.core.v01.events.LinkEnterEvent;
-import org.matsim.api.core.v01.events.LinkLeaveEvent;
-import org.matsim.api.core.v01.events.PersonArrivalEvent;
-import org.matsim.api.core.v01.events.PersonDepartureEvent;
-import org.matsim.api.core.v01.events.PersonStuckEvent;
-import org.matsim.api.core.v01.events.VehicleEntersTrafficEvent;
-import org.matsim.api.core.v01.events.handler.ActivityEndEventHandler;
-import org.matsim.api.core.v01.events.handler.ActivityStartEventHandler;
-import org.matsim.api.core.v01.events.handler.LinkEnterEventHandler;
-import org.matsim.api.core.v01.events.handler.LinkLeaveEventHandler;
-import org.matsim.api.core.v01.events.handler.PersonArrivalEventHandler;
-import org.matsim.api.core.v01.events.handler.PersonDepartureEventHandler;
-import org.matsim.api.core.v01.events.handler.PersonStuckEventHandler;
-import org.matsim.api.core.v01.events.handler.VehicleEntersTrafficEventHandler;
+import org.matsim.api.core.v01.TransportMode;
+import org.matsim.api.core.v01.events.*;
+import org.matsim.api.core.v01.events.handler.*;
import org.matsim.api.core.v01.network.Link;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.testcases.MatsimTestUtils;
@@ -60,7 +47,7 @@ public class EventsReadersTest {
static class TestHandler implements ActivityEndEventHandler, PersonDepartureEventHandler, VehicleEntersTrafficEventHandler,
LinkLeaveEventHandler, LinkEnterEventHandler, PersonArrivalEventHandler, ActivityStartEventHandler,
- PersonStuckEventHandler {
+ PersonStuckEventHandler, PersonMoneyEventHandler {
public int eventCounter = 0;
@@ -141,6 +128,17 @@ public void handleEvent(final PersonStuckEvent event) {
assertEquals("9", event.getLinkId().toString());
}
+ @Override
+ public void handleEvent(final PersonMoneyEvent event) {
+ this.eventCounter++;
+ assertEquals(9, this.eventCounter, "expected personMoney-Event to be event #9");
+ assertEquals(21690.0, event.getTime(), 0.0);
+ assertEquals("9", event.getPersonId().toString());
+ assertEquals("drtFare", event.getPurpose());
+ assertEquals(TransportMode.drt, event.getTransactionPartner());
+ assertEquals(-1.0, event.getAmount(), 0.0);
+ assertEquals("drt_0", event.getReference());
+ }
}
@Test
diff --git a/matsim/src/test/resources/test/input/org/matsim/core/events/EventsReadersTest/events.xml b/matsim/src/test/resources/test/input/org/matsim/core/events/EventsReadersTest/events.xml
index d73dc9a2f37..260841c6768 100644
--- a/matsim/src/test/resources/test/input/org/matsim/core/events/EventsReadersTest/events.xml
+++ b/matsim/src/test/resources/test/input/org/matsim/core/events/EventsReadersTest/events.xml
@@ -9,4 +9,5 @@
-
\ No newline at end of file
+
+