@Override public void handleEvent(WarmEmissionEvent event) { Id<Person> driverId = Id.createPersonId( event .getVehicleId()); // TODO [AA]: either it should be mapped to vehicle id or read // events file too to get driver id if (this.af != null) { // area filtering Link link = network.getLinks().get(event.getLinkId()); if (!this.af.isLinkInsideShape(link)) return; if (this.ug == null || this.pf == null) { // only area filtering delegate.handleEvent(event); } else if (this.pf .getUserGroupAsStringFromPersonId(driverId) .equals(this.ug)) { // both filtering delegate.handleEvent(event); } } else { if (this.ug == null || this.pf == null) { // no filtering delegate.handleEvent(event); } else if (this.pf .getUserGroupAsStringFromPersonId(driverId) .equals(this.ug)) { // user group filtering delegate.handleEvent(event); } } }
@Override public void handleEvent(WarmEmissionEvent event) { // calc emission costs of event double emissionCost = ecm.calculateWarmEmissionCosts(event.getWarmEmissions()); // calc time bin of event int timeBin = getTimeBin(event.getTime()); // user group UserGroup userGroup = getUserGroup(event.getVehicleId()); Id<Link> linkId = event.getLinkId(); // store cost for (timebin x usergroup x link) combination timeBin2group2link2flatEmissionCost .get(timeBin) .addEmissionCosts(userGroup, linkId, emissionCost); }