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;
import org.jfree.ui.ApplicationFrame;
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
* @author Marc Schiller
* @version 1.0, 15 Dec 2016
*/
public class Graph extends ApplicationFrame {
public class Graph extends ApplicationFrame implements EventHandler {
AbstractModel model = null;
public 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) {
this.model = model;
}
@Override
public void eventOccurred(Object content, int type) {
if (model.getDebug()) {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
// TODO: Get max users.
for (int i = 0; i <= 500; i += 1) {
System.out.println(model.getDouble(i));
//FIXME: Don't get users via Oracle
for (int i = 0; i < Oracle.getAllHosts().size(); i += 1) {
dataset.addValue(model.getDouble(i), "Value",
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