Commit ae7828ba authored by Marc Schiller's avatar Marc Schiller
Browse files

Get users via Oracle for debug graph.

parent dce2af64
...@@ -28,25 +28,35 @@ import org.jfree.data.category.DefaultCategoryDataset; ...@@ -28,25 +28,35 @@ import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.ApplicationFrame; import org.jfree.ui.ApplicationFrame;
import de.tud.kom.p2psim.impl.topology.views.fiveg.models.AbstractModel; import de.tud.kom.p2psim.impl.topology.views.fiveg.models.AbstractModel;
import de.tudarmstadt.maki.simonstrator.api.Event;
import de.tudarmstadt.maki.simonstrator.api.EventHandler;
import de.tudarmstadt.maki.simonstrator.api.Oracle;
/** /**
* A simple graph for debugging the models * A simple graph for debugging the models
* @author Marc Schiller * @author Marc Schiller
* @version 1.0, 15 Dec 2016 * @version 1.0, 15 Dec 2016
*/ */
public class Graph extends ApplicationFrame { public class Graph extends ApplicationFrame implements EventHandler {
AbstractModel model = null;
public Graph() { public Graph() {
super("Debug Graph"); super("Debug Graph");
// TODO: Schließen ohne simonstrator zu killen. Event.scheduleImmediately(this, null, 0);
//FIXME: Don't close Simonstrator when closing debug window
} }
public void setModel(AbstractModel model) { public void setModel(AbstractModel model) {
this.model = model;
}
@Override
public void eventOccurred(Object content, int type) {
if (model.getDebug()) { if (model.getDebug()) {
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); DefaultCategoryDataset dataset = new DefaultCategoryDataset();
// TODO: Get max users. //FIXME: Don't get users via Oracle
for (int i = 0; i <= 500; i += 1) { for (int i = 0; i < Oracle.getAllHosts().size(); i += 1) {
System.out.println(model.getDouble(i));
dataset.addValue(model.getDouble(i), "Value", dataset.addValue(model.getDouble(i), "Value",
Integer.toString(i)); Integer.toString(i));
} }
......
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