public void buildDisplay() { if (layoutType.equals("KK")) { graphLayout = new KamadaGraphLayout(agentList, worldXSize, worldYSize, surface, updateEveryN); } else if (layoutType.equals("Fruch")) { graphLayout = new FruchGraphLayout(agentList, worldXSize, worldYSize, surface, updateEveryN); } else if (layoutType.equals("CircleLayout")) { graphLayout = new CircularGraphLayout(agentList, worldXSize, worldYSize); } // these four lines hook up the graph layouts to the stop, pause, and // exit buttons on the toolbar. When stop, pause, or exit is clicked // the graph layouts will interrupt their layout as soon as possible. Controller c = (Controller) getController(); c.addStopListener(graphLayout); c.addPauseListener(graphLayout); c.addExitListener(graphLayout); Network2DDisplay display = new Network2DDisplay(graphLayout); surface.addDisplayableProbeable(display, "JinGirNew Display"); // add the display as a Zoomable. This means we can "zoom" in on // various parts of the network. surface.addZoomable(display); surface.setBackground(java.awt.Color.white); addSimEventListener(surface); }
public void initialAction() { randomMeeting(); neighborMeeting(); graphLayout.updateLayout(); surface.updateDisplay(); if (showHist) degreeDist.step(); if (showPlot) graph.step(); }
public void begin() { buildModel(); buildDisplay(); buildSchedule(); graphLayout.updateLayout(); surface.display(); if (showHist) degreeDist.display(); if (showPlot) graph.display(); }
public void mainAction() { randomMeeting(); neighborMeeting(); removeRandomFriendship(); graphLayout.updateLayout(); surface.updateDisplay(); if (showHist) degreeDist.step(); if (showPlot) graph.step(); // System.out.println(NetUtilities.getComponents(agentList).size()); }
public void setup() { Random.createUniform(); if (surface != null) surface.dispose(); if (degreeDist != null) degreeDist.dispose(); if (graph != null) graph.dispose(); surface = null; schedule = null; degreeDist = null; graph = null; System.gc(); surface = new DisplaySurface(this, "JinGirModelII Display"); registerDisplaySurface("Main Display", surface); schedule = new Schedule(); agentList = new ArrayList(); worldXSize = 500; worldYSize = 500; }