Commit 5c5b4b62 authored by Julian Zobel's avatar Julian Zobel 🦄
Browse files

Added component step size list to tracefile movement (required for metrics)

parent 6445bb20
......@@ -75,13 +75,14 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
protected boolean initialized = false;
private final LinkedHashMap<SimLocationActuator, LinkedList<Step>> components;
private final static LinkedHashMap<SimLocationActuator, Integer> componentToStepSize = new LinkedHashMap<SimLocationActuator, Integer>();
private LinkedList<File> tracefiles;
private boolean first = true;
public TracefileMovementModel() {
components = new LinkedHashMap<SimLocationActuator, LinkedList<Step>>();
tracefiles = new LinkedList<File>();
tracefiles = new LinkedList<File>();
}
public void initialize() {
......@@ -147,10 +148,16 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
shutdownComponent(component);
}
// do nothing for smoothing?
// TODO
else {
int stepcount = componentToStepSize.get(component);
stepcount++;
componentToStepSize.put(component, stepcount);
}
}
else {
if(DefaultTopology.isWithinWorldBoundaries(component.getRealPosition())) {
// TODO
long delta = step.timestamp - currentTime + GPS_MISSING_TRACE_THRESHOLD;
if(delta > 0 && delta <= 2) {
......@@ -187,6 +194,11 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
}
else {
step = steps.pop();
// TODO
int stepcount = componentToStepSize.get(component);
stepcount++;
componentToStepSize.put(component, stepcount);
if(!DefaultTopology.isWithinWorldBoundaries(component.getRealPosition())) {
component.updateCurrentLocation(new PositionVector(step.x, step.y));
......@@ -319,6 +331,17 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
// System.out.println(actuator.getHost().getId() + " <> " + tracefile.getName());
components.put(actuator, stepQueue);
componentToStepSize.put(actuator, 0);
}
public static int getComponentStepSize(SimLocationActuator component) {
if(!componentToStepSize.containsKey(component)) {
return -1;
}
return componentToStepSize.get(component);
}
@Override
......
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