Commit db12ac1c authored by Mario Teixeira Parente's avatar Mario Teixeira Parente
Browse files

Merge branch 'dev/processors' into develop

parents 1709d0cd 8de07160
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianDensityProcessor; import org.vadere.state.attributes.processor.AttributesPedestrianDensityProcessor;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
...@@ -11,7 +11,7 @@ import org.vadere.state.scenario.Pedestrian; ...@@ -11,7 +11,7 @@ import org.vadere.state.scenario.Pedestrian;
* *
*/ */
public abstract class PedestrianDensityProcessor extends DataProcessor<TimestepPedestrianIdDataKey, Double> { public abstract class PedestrianDensityProcessor extends DataProcessor<TimestepPedestrianIdKey, Double> {
private PedestrianPositionProcessor pedPosProc; private PedestrianPositionProcessor pedPosProc;
private IPointDensityAlgorithm densAlg; private IPointDensityAlgorithm densAlg;
...@@ -25,7 +25,7 @@ public abstract class PedestrianDensityProcessor extends DataProcessor<TimestepP ...@@ -25,7 +25,7 @@ public abstract class PedestrianDensityProcessor extends DataProcessor<TimestepP
this.pedPosProc.update(state); this.pedPosProc.update(state);
state.getTopography().getElements(Pedestrian.class).stream() state.getTopography().getElements(Pedestrian.class).stream()
.forEach(ped -> this.addValue(new TimestepPedestrianIdDataKey(state.getStep(), ped.getId()), .forEach(ped -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), ped.getId()),
this.densAlg.getDensity(ped.getPosition(), state))); this.densAlg.getDensity(ped.getPosition(), state)));
} }
......
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import java.util.Collection; import java.util.Collection;
...@@ -12,7 +12,7 @@ import java.util.Collection; ...@@ -12,7 +12,7 @@ import java.util.Collection;
* *
*/ */
public class PedestrianEndTimeProcessor extends DataProcessor<PedestrianIdDataKey, Double> { public class PedestrianEndTimeProcessor extends DataProcessor<PedestrianIdKey, Double> {
public PedestrianEndTimeProcessor() { public PedestrianEndTimeProcessor() {
super("endTime"); super("endTime");
} }
...@@ -33,7 +33,7 @@ public class PedestrianEndTimeProcessor extends DataProcessor<PedestrianIdDataKe ...@@ -33,7 +33,7 @@ public class PedestrianEndTimeProcessor extends DataProcessor<PedestrianIdDataKe
} }
private void setValues(Collection<Pedestrian> peds, double value) { private void setValues(Collection<Pedestrian> peds, double value) {
peds.stream().map(ped -> new PedestrianIdDataKey(ped.getId())) peds.stream().map(ped -> new PedestrianIdKey(ped.getId()))
.forEach(key -> this.addValue(key, value)); .forEach(key -> this.setValue(key, value));
} }
} }
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianEvacuationTimeProcessor; import org.vadere.state.attributes.processor.AttributesPedestrianEvacuationTimeProcessor;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
...@@ -11,7 +11,7 @@ import org.vadere.state.scenario.Pedestrian; ...@@ -11,7 +11,7 @@ import org.vadere.state.scenario.Pedestrian;
* *
*/ */
public class PedestrianEvacuationTimeProcessor extends DataProcessor<PedestrianIdDataKey, Double> { public class PedestrianEvacuationTimeProcessor extends DataProcessor<PedestrianIdKey, Double> {
private PedestrianStartTimeProcessor pedStTimeProc; private PedestrianStartTimeProcessor pedStTimeProc;
public PedestrianEvacuationTimeProcessor() { public PedestrianEvacuationTimeProcessor() {
...@@ -23,15 +23,15 @@ public class PedestrianEvacuationTimeProcessor extends DataProcessor<PedestrianI ...@@ -23,15 +23,15 @@ public class PedestrianEvacuationTimeProcessor extends DataProcessor<PedestrianI
this.pedStTimeProc.update(state); this.pedStTimeProc.update(state);
state.getTopography().getElements(Pedestrian.class).stream() state.getTopography().getElements(Pedestrian.class).stream()
.map(ped -> new PedestrianIdDataKey(ped.getId())) .map(ped -> new PedestrianIdKey(ped.getId()))
.forEach(key -> this.addValue(key, state.getSimTimeInSec() - this.pedStTimeProc.getValue(key))); .forEach(key -> this.setValue(key, state.getSimTimeInSec() - this.pedStTimeProc.getValue(key)));
} }
@Override @Override
public void postLoop(final SimulationState state) { public void postLoop(final SimulationState state) {
state.getTopography().getElements(Pedestrian.class).stream() state.getTopography().getElements(Pedestrian.class).stream()
.map(ped -> new PedestrianIdDataKey(ped.getId())) .map(ped -> new PedestrianIdKey(ped.getId()))
.forEach(key -> this.addValue(key, Double.NaN)); .forEach(key -> this.setValue(key, Double.NaN));
} }
@Override @Override
......
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianFlowProcessor; import org.vadere.state.attributes.processor.AttributesPedestrianFlowProcessor;
import java.util.Set; import java.util.Set;
...@@ -13,7 +13,7 @@ import java.util.stream.Collectors; ...@@ -13,7 +13,7 @@ import java.util.stream.Collectors;
* *
*/ */
public class PedestrianFlowProcessor extends DataProcessor<TimestepPedestrianIdDataKey, Double> { public class PedestrianFlowProcessor extends DataProcessor<TimestepPedestrianIdKey, Double> {
private PedestrianVelocityProcessor pedVelProc; private PedestrianVelocityProcessor pedVelProc;
private PedestrianDensityProcessor pedDensProc; private PedestrianDensityProcessor pedDensProc;
...@@ -26,13 +26,13 @@ public class PedestrianFlowProcessor extends DataProcessor<TimestepPedestrianIdD ...@@ -26,13 +26,13 @@ public class PedestrianFlowProcessor extends DataProcessor<TimestepPedestrianIdD
this.pedVelProc.update(state); this.pedVelProc.update(state);
this.pedDensProc.update(state); this.pedDensProc.update(state);
Set<TimestepPedestrianIdDataKey> keys = this.pedVelProc.getKeys().stream().filter(key -> key.getTimestep() == state.getStep()).collect(Collectors.toSet()); Set<TimestepPedestrianIdKey> keys = this.pedVelProc.getKeys().stream().filter(key -> key.getTimestep() == state.getStep()).collect(Collectors.toSet());
for (TimestepPedestrianIdDataKey key : keys) { for (TimestepPedestrianIdKey key : keys) {
double velocity = this.pedVelProc.getValue(key); double velocity = this.pedVelProc.getValue(key);
double density = this.pedDensProc.getValue(key); double density = this.pedDensProc.getValue(key);
this.addValue(key, velocity * density); this.setValue(key, velocity * density);
} }
} }
......
...@@ -2,8 +2,8 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,8 +2,8 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianLastPositionProcessor; import org.vadere.state.attributes.processor.AttributesPedestrianLastPositionProcessor;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
...@@ -14,7 +14,7 @@ import java.util.Map; ...@@ -14,7 +14,7 @@ import java.util.Map;
* *
*/ */
public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdDataKey, VPoint> { public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdKey, VPoint> {
private PedestrianPositionProcessor pedPosProc; private PedestrianPositionProcessor pedPosProc;
public PedestrianLastPositionProcessor() { public PedestrianLastPositionProcessor() {
...@@ -26,8 +26,8 @@ public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdD ...@@ -26,8 +26,8 @@ public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdD
this.pedPosProc.update(state); this.pedPosProc.update(state);
Map<Integer, VPoint> pedPosMap = state.getPedestrianPositionMap(); Map<Integer, VPoint> pedPosMap = state.getPedestrianPositionMap();
pedPosMap.keySet().forEach(pedId -> this.addValue(new PedestrianIdDataKey(pedId), pedPosMap.keySet().forEach(pedId -> this.setValue(new PedestrianIdKey(pedId),
this.pedPosProc.getValue(new TimestepPedestrianIdDataKey(state.getStep(), pedId)))); this.pedPosProc.getValue(new TimestepPedestrianIdKey(state.getStep(), pedId))));
} }
@Override @Override
...@@ -39,7 +39,7 @@ public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdD ...@@ -39,7 +39,7 @@ public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdD
} }
@Override @Override
public String[] toStrings(final PedestrianIdDataKey key) { public String[] toStrings(final PedestrianIdKey key) {
VPoint pos = this.getValue(key); VPoint pos = this.getValue(key);
return new String[] { Double.toString(pos.x), Double.toString(pos.y) }; return new String[] { Double.toString(pos.x), Double.toString(pos.y) };
......
...@@ -4,7 +4,7 @@ import org.vadere.simulator.control.SimulationState; ...@@ -4,7 +4,7 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.models.Model; import org.vadere.simulator.models.Model;
import org.vadere.simulator.models.osm.OptimalStepsModel; import org.vadere.simulator.models.osm.OptimalStepsModel;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import java.util.Collection; import java.util.Collection;
...@@ -14,7 +14,7 @@ import java.util.Collection; ...@@ -14,7 +14,7 @@ import java.util.Collection;
* *
*/ */
public class PedestrianOSMStrideLengthProcessor extends DataProcessor<TimestepPedestrianIdDataKey, Double> { public class PedestrianOSMStrideLengthProcessor extends DataProcessor<TimestepPedestrianIdKey, Double> {
private OptimalStepsModel osm; private OptimalStepsModel osm;
public PedestrianOSMStrideLengthProcessor() { public PedestrianOSMStrideLengthProcessor() {
...@@ -27,7 +27,7 @@ public class PedestrianOSMStrideLengthProcessor extends DataProcessor<TimestepPe ...@@ -27,7 +27,7 @@ public class PedestrianOSMStrideLengthProcessor extends DataProcessor<TimestepPe
protected void doUpdate(final SimulationState state) { protected void doUpdate(final SimulationState state) {
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class); Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
// TODO: if osm != null then compute stridelength // TODO: if osm != null then compute stridelength
peds.forEach(ped -> this.addValue(new TimestepPedestrianIdDataKey(state.getStep(), ped.getId()), this.osm == null ? Double.NaN : 0.0)); peds.forEach(ped -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), ped.getId()), this.osm == null ? Double.NaN : 0.0));
// TODO Use this comment from the old implementation for this implementation // TODO Use this comment from the old implementation for this implementation
// @Override // @Override
......
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesPedestrianOverlapProcessor; import org.vadere.state.attributes.processor.AttributesPedestrianOverlapProcessor;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
...@@ -13,7 +13,7 @@ import java.util.Map; ...@@ -13,7 +13,7 @@ import java.util.Map;
* *
*/ */
public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrianIdDataKey, Integer> { public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrianIdKey, Integer> {
private double pedRadius; private double pedRadius;
public PedestrianOverlapProcessor() { public PedestrianOverlapProcessor() {
...@@ -24,7 +24,7 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian ...@@ -24,7 +24,7 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
protected void doUpdate(final SimulationState state) { protected void doUpdate(final SimulationState state) {
Map<Integer, VPoint> pedPosMap = state.getPedestrianPositionMap(); Map<Integer, VPoint> pedPosMap = state.getPedestrianPositionMap();
pedPosMap.entrySet().forEach(entry -> this.addValue(new TimestepPedestrianIdDataKey(state.getStep(), entry.getKey()), this.calculateOverlaps(pedPosMap, entry.getValue()))); pedPosMap.entrySet().forEach(entry -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), entry.getKey()), this.calculateOverlaps(pedPosMap, entry.getValue())));
} }
@Override @Override
......
...@@ -2,9 +2,9 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,9 +2,9 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
import java.util.Map; import java.util.Map;
...@@ -16,16 +16,16 @@ import java.util.stream.Collectors; ...@@ -16,16 +16,16 @@ import java.util.stream.Collectors;
* *
*/ */
public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestrianIdDataKey, VPoint> { public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestrianIdKey, VPoint> {
public PedestrianPositionProcessor() { public PedestrianPositionProcessor() {
super("x", "y"); super("x", "y");
} }
public Map<PedestrianIdDataKey, VPoint> getPositions(TimestepDataKey timestepKey) { public Map<PedestrianIdKey, VPoint> getPositions(TimestepKey timestepKey) {
return this.getData().entrySet().stream() return this.getData().entrySet().stream()
.filter(e -> e.getKey().equals(timestepKey)) .filter(e -> e.getKey().equals(timestepKey))
.collect(Collectors.toMap(e -> new PedestrianIdDataKey(e.getKey().getPedestrianId()), e -> e.getValue())); .collect(Collectors.toMap(e -> new PedestrianIdKey(e.getKey().getPedestrianId()), e -> e.getValue()));
} }
@Override @Override
...@@ -37,7 +37,7 @@ public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestria ...@@ -37,7 +37,7 @@ public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestria
Integer pedId = entry.getKey(); Integer pedId = entry.getKey();
VPoint pos = entry.getValue(); VPoint pos = entry.getValue();
this.addValue(new TimestepPedestrianIdDataKey(timeStep, pedId), pos); this.setValue(new TimestepPedestrianIdKey(timeStep, pedId), pos);
} }
} }
...@@ -45,7 +45,7 @@ public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestria ...@@ -45,7 +45,7 @@ public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestria
public void init(final ProcessorManager manager) {} public void init(final ProcessorManager manager) {}
@Override @Override
public String[] toStrings(TimestepPedestrianIdDataKey key) { public String[] toStrings(TimestepPedestrianIdKey key) {
VPoint p = this.getValue(key); VPoint p = this.getValue(key);
return new String[] { Double.toString(p.x), Double.toString(p.y) }; return new String[] { Double.toString(p.x), Double.toString(p.y) };
......
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Source; import org.vadere.state.scenario.Source;
...@@ -13,7 +13,7 @@ import java.util.Collection; ...@@ -13,7 +13,7 @@ import java.util.Collection;
* *
*/ */
public class PedestrianSourceIdProcessor extends DataProcessor<PedestrianIdDataKey, Integer> { public class PedestrianSourceIdProcessor extends DataProcessor<PedestrianIdKey, Integer> {
public PedestrianSourceIdProcessor() { public PedestrianSourceIdProcessor() {
super("sourceId"); super("sourceId");
...@@ -26,7 +26,7 @@ public class PedestrianSourceIdProcessor extends DataProcessor<PedestrianIdDataK ...@@ -26,7 +26,7 @@ public class PedestrianSourceIdProcessor extends DataProcessor<PedestrianIdDataK
peds.forEach(p -> { peds.forEach(p -> {
final Source s = p.getSource(); final Source s = p.getSource();
final int sourceId = (s == null) ? -1 : s.getId(); final int sourceId = (s == null) ? -1 : s.getId();
this.addValue(new PedestrianIdDataKey(p.getId()), sourceId); this.setValue(new PedestrianIdKey(p.getId()), sourceId);
}); });
} }
......
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import java.util.Set; import java.util.Set;
...@@ -12,7 +12,7 @@ import java.util.Set; ...@@ -12,7 +12,7 @@ import java.util.Set;
* *
*/ */
public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdDataKey, Double> { public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdKey, Double> {
public PedestrianStartTimeProcessor() { public PedestrianStartTimeProcessor() {
super("startTime"); super("startTime");
...@@ -21,7 +21,7 @@ public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdData ...@@ -21,7 +21,7 @@ public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdData
@Override @Override
protected void doUpdate(final SimulationState state) { protected void doUpdate(final SimulationState state) {
state.getTopography().getElements(Pedestrian.class).stream() state.getTopography().getElements(Pedestrian.class).stream()
.forEach(ped -> this.update(new PedestrianIdDataKey(ped.getId()), state.getSimTimeInSec())); .forEach(ped -> this.update(new PedestrianIdKey(ped.getId()), state.getSimTimeInSec()));
} }
@Override @Override
...@@ -29,10 +29,10 @@ public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdData ...@@ -29,10 +29,10 @@ public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdData
// No initialization needed // No initialization needed
} }
private void update(PedestrianIdDataKey pedIdKey, double startTime) { private void update(PedestrianIdKey pedIdKey, double startTime) {
Set<PedestrianIdDataKey> keys = this.getKeys(); Set<PedestrianIdKey> keys = this.getKeys();
if (!keys.contains(pedIdKey)) if (!keys.contains(pedIdKey))
this.addValue(pedIdKey, startTime); this.setValue(pedIdKey, startTime);
} }
} }
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.simulator.control.SimulationState; import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager; import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdDataKey; import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import java.util.Collection; import java.util.Collection;
...@@ -12,7 +12,7 @@ import java.util.Collection; ...@@ -12,7 +12,7 @@ import java.util.Collection;
* *
*/ */
public class PedestrianTargetIdProcessor extends DataProcessor<TimestepPedestrianIdDataKey, Integer> { public class PedestrianTargetIdProcessor extends DataProcessor<TimestepPedestrianIdKey, Integer> {
public PedestrianTargetIdProcessor() { public PedestrianTargetIdProcessor() {
super("targetId"); super("targetId");
...@@ -22,7 +22,7 @@ public class PedestrianTargetIdProcessor extends DataProcessor<TimestepPedestria ...@@ -22,7 +22,7 @@ public class PedestrianTargetIdProcessor extends DataProcessor<TimestepPedestria
public void doUpdate(final SimulationState state) { public void doUpdate(final SimulationState state) {
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class); Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
peds.forEach(p -> this.addValue(new TimestepPedestrianIdDataKey(state.getStep(), p.getId()), peds.forEach(p -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), p.getId()),
p.getTargets().isEmpty() ? -1 : p.getTargets().getFirst())); p.getTargets().isEmpty() ? -1 : p.getTargets().getFirst()));
} }
......
...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor; ...@@ -2,7 +2,7 @@ package org.vadere.simulator.projects.dataprocessing.processor;