Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 9e8f1624 authored by Marion Goedel's avatar Marion Goedel
Browse files

Added a new processor (only for BHM!): PedestrianBehaviourProcessor

parent 9f4c3b9a
package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.models.bhm.PedestrianBHM;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.scenario.Pedestrian;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* @author Marion Gödel
*
*/
@DataProcessorClass()
public class PedestrianBehaviourProcessor extends DataProcessor<TimestepPedestrianIdKey, Integer> {
public PedestrianBehaviourProcessor() {
super("behaviourId");
}
@Override
public void doUpdate(final SimulationState state) {
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
peds.stream().filter(pedestrian -> pedestrian instanceof PedestrianBHM).forEach(p -> this.putValue(new TimestepPedestrianIdKey(state.getStep(), p.getId()),
((PedestrianBHM) p).getBehaviour()));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment