Commit 7f590a14 authored by Julian Zobel's avatar Julian Zobel
Browse files

sim iscram

parent 125d6756
......@@ -23,6 +23,7 @@ package de.tud.kom.p2psim.impl.topology.movement;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
......@@ -42,6 +43,7 @@ import de.tud.kom.p2psim.impl.topology.views.VisualizationTopologyView.Visualiza
import de.tudarmstadt.maki.simonstrator.api.Event;
import de.tudarmstadt.maki.simonstrator.api.EventHandler;
import de.tudarmstadt.maki.simonstrator.api.Monitor;
import de.tudarmstadt.maki.simonstrator.api.Monitor.Level;
import de.tudarmstadt.maki.simonstrator.api.Time;
import de.tudarmstadt.maki.simonstrator.api.component.LifecycleComponent;
......@@ -75,13 +77,17 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
private final LinkedHashMap<SimLocationActuator, LinkedList<Step>> components;
private final static LinkedHashMap<SimLocationActuator, Integer> componentToStepSize = new LinkedHashMap<SimLocationActuator, Integer>();
private final LinkedHashSet<SimLocationActuator> unusedComponents;
private LinkedList<File> tracefiles;
private boolean first = true;
public TracefileMovementModel() {
components = new LinkedHashMap<SimLocationActuator, LinkedList<Step>>();
tracefiles = new LinkedList<File>();
tracefiles = new LinkedList<File>();
unusedComponents = new LinkedHashSet<SimLocationActuator>();
}
public void initialize() {
......@@ -127,7 +133,11 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
if(first) {
components.forEach((component, steps) -> {
shutdownComponent(component);
});
});
unusedComponents.forEach((component) -> {
shutdownComponent(component);
});
}
// as the files contain the timestamp in seconds, the current time needs to be converted in seconds
......@@ -292,7 +302,10 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
private void associateTracefile(SimLocationActuator actuator) {
if(tracefiles.isEmpty()) {
throw new UnsupportedOperationException("List of tracefiles is empty, thus cannot initiate the component!");
Monitor.log(this.getClass(), Level.WARN, "No unassociated trace file available. Skip.", actuator);
//throw new UnsupportedOperationException("List of tracefiles is empty, thus cannot initiate the component!");
unusedComponents.add(actuator);
return;
}
if(components.containsKey(actuator)) {
......@@ -364,7 +377,7 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
this.attractionpointVisualization = viz;
}
public void setIAttractionGenerator(IAttractionProvider attractionGenerator) {
public void setIAttractionProvider(IAttractionProvider attractionGenerator) {
if (attractionGenerator == null) {
throw new ConfigurationException(
"AttractionGenerator is missing in ModularMovementModel!");
......
......@@ -101,7 +101,7 @@ public class AttractionPointViz extends JComponent
drawAttractionPoints(g2);
}
if(true) {
if(false) {
drawClusters(g2);
}
}
......@@ -126,8 +126,13 @@ public class AttractionPointViz extends JComponent
for (LinkedList<SimHost> group : clusters) {
g2.setColor(colors.get(clusters.indexOf(group)));
try {
g2.setColor(colors.get(clusters.indexOf(group)));
}
catch (Exception e) {
g2.setColor(Color.black);
}
for (SimHost member : group) {
PositionVector p = member.getTopologyComponent().getRealPosition();
......
......@@ -24,7 +24,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
import org.json.JSONException;
......
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