The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 165fbca9 authored by Jakob Schöttl's avatar Jakob Schöttl
Browse files

Rename method

putValue instead of setValue because the data structure is (inherently)
a map.

"set" suggests setting something like an existing property. In fact a value is
either added (if not existing) or updated (if existing). In programming
terms, "put" is the best verb for that.
parent ddcd3966
......@@ -18,6 +18,6 @@ public abstract class AreaDensityProcessor extends AreaDataProcessor<Double> {
@Override
protected void doUpdate(final SimulationState state) {
this.setValue(new TimestepKey(state.getStep()), this.densAlg.getDensity(state));
this.putValue(new TimestepKey(state.getStep()), this.densAlg.getDensity(state));
}
}
......@@ -45,7 +45,7 @@ public class AreaSpeedProcessor extends AreaDataProcessor<Double> {
}
}
this.setValue(new TimestepKey(step), sumVelocities / pedCount);
this.putValue(new TimestepKey(step), sumVelocities / pedCount);
}
@Override
......
......@@ -20,7 +20,7 @@ import java.util.TreeMap;
*
* The method <tt>doUpdate</tt> gets called after every simulation step with the current <tt>SimulationState</tt>.
* Here, one gets the opportunity to compute a new value or to update the state for a computation in <tt>postLoop</tt>.
* The computed value can be stored afterwards in the data by using the <tt>setValue</tt> method.
* The computed value can be stored afterwards in the data by using the <tt>putValue</tt> method.
*
* To get specific attributes defined in JSON or access to the <tt>MainModel</tt>, one has to use the <tt>init</tt> method which
* gives access to all significant things via the argument <tt>manager</tt> of type <tt>ProcessorManager</tt>.
......@@ -96,7 +96,7 @@ public abstract class DataProcessor<K extends DataKey<K>, V> {
return data.get(key);
}
protected void setValue(final K key, final V value) {
protected void putValue(final K key, final V value) {
this.data.put(key, value);
}
......
......@@ -36,7 +36,7 @@ public class EvacuationTimeProcessor extends DataProcessor<NoDataKey, Double> {
: Collections.max(this.pedEvacTimeProc.getValues());
}
this.setValue(NoDataKey.key(), result);
this.putValue(NoDataKey.key(), result);
}
@Override
......
......@@ -13,7 +13,7 @@ public class FloorFieldGridProcessor extends DataProcessor<TimestepRowKey, Floor
protected void doUpdate(SimulationState state) {
// First try, TODO: Implementation
for (int i = 0; i < 50; ++i) {
this.setValue(new TimestepRowKey(state.getStep(), i), new FloorFieldGridRow(50));
this.putValue(new TimestepRowKey(state.getStep(), i), new FloorFieldGridRow(50));
}
}
......
......@@ -22,7 +22,7 @@ public class FloorFieldProcessor extends DataProcessor<TimestepPositionKey, Doub
// First try, TODO: Implementation
for (int x = 0; x < 50; ++x) {
for (int y = 0; y < 50; ++y) {
this.setValue(new TimestepPositionKey(state.getStep(), new VPoint(x, y)), 0.0);
this.putValue(new TimestepPositionKey(state.getStep(), new VPoint(x, y)), 0.0);
}
}
}
......
......@@ -40,7 +40,7 @@ public class MeanPedestrianEvacuationTimeProcessor extends DataProcessor<NoDataK
.collect(Collectors.toList());
int count = nonNans.size();
this.setValue(NoDataKey.key(), count > 0
this.putValue(NoDataKey.key(), count > 0
? nonNans.stream().reduce(0.0, (val1, val2) -> val1 + val2) / count
: Double.NaN);
}
......
......@@ -25,7 +25,7 @@ public abstract class PedestrianDensityProcessor extends DataProcessor<TimestepP
this.pedPosProc.update(state);
state.getTopography().getElements(Pedestrian.class).stream()
.forEach(ped -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), ped.getId()),
.forEach(ped -> this.putValue(new TimestepPedestrianIdKey(state.getStep(), ped.getId()),
this.densAlg.getDensity(ped.getPosition(), state)));
}
......
......@@ -34,6 +34,6 @@ public class PedestrianEndTimeProcessor extends DataProcessor<PedestrianIdKey, D
private void setValues(Collection<Pedestrian> peds, double value) {
peds.stream().map(ped -> new PedestrianIdKey(ped.getId()))
.forEach(key -> this.setValue(key, value));
.forEach(key -> this.putValue(key, value));
}
}
......@@ -56,14 +56,14 @@ public class PedestrianEvacuationTimeProcessor extends DataProcessor<PedestrianI
state.getTopography().getElements(Pedestrian.class).stream()
.map(ped -> new PedestrianIdKey(ped.getId()))
.forEach(key -> this.setValue(key, state.getSimTimeInSec() - pedStartTimeProc.getValue(key)));
.forEach(key -> this.putValue(key, state.getSimTimeInSec() - pedStartTimeProc.getValue(key)));
}
@Override
public void postLoop(final SimulationState state) {
state.getTopography().getElements(Pedestrian.class).stream()
.map(ped -> new PedestrianIdKey(ped.getId()))
.forEach(key -> this.setValue(key, Double.NaN));
.forEach(key -> this.putValue(key, Double.NaN));
}
}
......@@ -32,7 +32,7 @@ public class PedestrianFlowProcessor extends DataProcessor<TimestepPedestrianIdK
double velocity = this.pedVelProc.getValue(key);
double density = this.pedDensProc.getValue(key);
this.setValue(key, velocity * density);
this.putValue(key, velocity * density);
}
}
......
......@@ -26,7 +26,7 @@ public class PedestrianLastPositionProcessor extends DataProcessor<PedestrianIdK
this.pedPosProc.update(state);
Map<Integer, VPoint> pedPosMap = state.getPedestrianPositionMap();
pedPosMap.keySet().forEach(pedId -> this.setValue(new PedestrianIdKey(pedId),
pedPosMap.keySet().forEach(pedId -> this.putValue(new PedestrianIdKey(pedId),
this.pedPosProc.getValue(new TimestepPedestrianIdKey(state.getStep(), pedId))));
}
......
......@@ -27,7 +27,7 @@ public class PedestrianOSMStrideLengthProcessor extends DataProcessor<TimestepPe
protected void doUpdate(final SimulationState state) {
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
// TODO: if osm != null then compute stridelength
peds.forEach(ped -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), ped.getId()), this.osm == null ? Double.NaN : 0.0));
peds.forEach(ped -> this.putValue(new TimestepPedestrianIdKey(state.getStep(), ped.getId()), this.osm == null ? Double.NaN : 0.0));
// TODO Use this comment from the old implementation for this implementation
// @Override
......
......@@ -24,7 +24,7 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
protected void doUpdate(final SimulationState state) {
Map<Integer, VPoint> pedPosMap = state.getPedestrianPositionMap();
pedPosMap.entrySet().forEach(entry -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), entry.getKey()), this.calculateOverlaps(pedPosMap, entry.getValue())));
pedPosMap.entrySet().forEach(entry -> this.putValue(new TimestepPedestrianIdKey(state.getStep(), entry.getKey()), this.calculateOverlaps(pedPosMap, entry.getValue())));
}
@Override
......
......@@ -37,7 +37,7 @@ public class PedestrianPositionProcessor extends DataProcessor<TimestepPedestria
Integer pedId = entry.getKey();
VPoint pos = entry.getValue();
this.setValue(new TimestepPedestrianIdKey(timeStep, pedId), pos);
this.putValue(new TimestepPedestrianIdKey(timeStep, pedId), pos);
}
}
......
......@@ -26,7 +26,7 @@ public class PedestrianSourceIdProcessor extends DataProcessor<PedestrianIdKey,
peds.forEach(p -> {
final Source s = p.getSource();
final int sourceId = (s == null) ? -1 : s.getId();
this.setValue(new PedestrianIdKey(p.getId()), sourceId);
this.putValue(new PedestrianIdKey(p.getId()), sourceId);
});
}
......
......@@ -33,6 +33,6 @@ public class PedestrianStartTimeProcessor extends DataProcessor<PedestrianIdKey,
Set<PedestrianIdKey> keys = this.getKeys();
if (!keys.contains(pedIdKey))
this.setValue(pedIdKey, startTime);
this.putValue(pedIdKey, startTime);
}
}
......@@ -44,7 +44,7 @@ public class PedestrianStateProcessor extends DataProcessor<TimestepPedestrianId
.count() > 0;
String pedState = pedEntryExists ? "m" : "c";
this.setValue(new TimestepPedestrianIdKey(state.getStep(), id), pedState);
this.putValue(new TimestepPedestrianIdKey(state.getStep(), id), pedState);
});
//detect deleted peds and inserts states d = deleted
......@@ -60,6 +60,6 @@ public class PedestrianStateProcessor extends DataProcessor<TimestepPedestrianId
.collect(Collectors.toList());
deletedPeds.stream()
.forEach(id -> this.setValue(new TimestepPedestrianIdKey(previousStep, id), "d"));
.forEach(id -> this.putValue(new TimestepPedestrianIdKey(previousStep, id), "d"));
}
}
......@@ -22,7 +22,7 @@ public class PedestrianTargetIdProcessor extends DataProcessor<TimestepPedestria
public void doUpdate(final SimulationState state) {
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
peds.forEach(p -> this.setValue(new TimestepPedestrianIdKey(state.getStep(), p.getId()),
peds.forEach(p -> this.putValue(new TimestepPedestrianIdKey(state.getStep(), p.getId()),
p.getTargets().isEmpty() ? -1 : p.getTargets().getFirst()));
}
......
......@@ -35,7 +35,7 @@ public class PedestrianVelocityProcessor extends DataProcessor<TimestepPedestria
Integer timeStep = state.getStep();
Stream<Integer> pedIds = state.getTopography().getElements(Pedestrian.class).stream().map(ped -> ped.getId());
pedIds.forEach(pedId -> this.setValue(new TimestepPedestrianIdKey(timeStep, pedId),
pedIds.forEach(pedId -> this.putValue(new TimestepPedestrianIdKey(timeStep, pedId),
this.getVelocity(timeStep, state.getSimTimeInSec(), pedId)));
if (this.lastSimTimes.size() >= this.backSteps)
......
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