/*
* File name: StupidBugCounterPlugin.java (package eas.users.lukas.demos.stupidModel)
* Author(s): Lukas König
* Java version: 6.0
* Generation date: 27.09.2011 (17:24:58)
*
* (c) This file and the EAS (Easy Agent Simulation) framework containing it
* is protected by Creative Commons by-nc-sa license. Any altered or
* further developed versions of this file have to meet the agreements
* stated by the license conditions.
*
* In a nutshell
* -------------
* You are free:
* - to Share -- to copy, distribute and transmit the work
* - to Remix -- to adapt the work
*
* Under the following conditions:
* - Attribution -- You must attribute the work in the manner specified by the
* author or licensor (but not in any way that suggests that they endorse
* you or your use of the work).
* - Noncommercial -- You may not use this work for commercial purposes.
* - Share Alike -- If you alter, transform, or build upon this work, you may
* distribute the resulting work only under the same or a similar license to
* this one.
*
* + Detailed license conditions (Germany):
* http://creativecommons.org/licenses/by-nc-sa/3.0/de/
* + Detailed license conditions (unported):
* http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en
*
* This header must be placed in the beginning of any version of this file.
*/
package eas.users.demos.stupidModel;
import java.util.List;
import org.jfree.data.category.DefaultCategoryDataset;
import eas.plugins.AbstractDefaultPlugin;
import eas.plugins.PluginProperties;
import eas.simulation.Wink;
import eas.simulation.event.EASEvent;
import eas.startSetup.ParCollection;
import eas.startSetup.SingleParameter;
/**
* @author Lukas König
*
*/
@PluginProperties (pluginIsHidden = true)
public class StupidBugCounterPlugin extends AbstractDefaultPlugin<StupidEnvironment> {
private static final long serialVersionUID = 961178847419366436L;
// private JFreeChart chart;
private DefaultCategoryDataset dataset;
// private StaticWindow show;
@Override
public List<String> getRequiredPlugins() {
return null;
}
@Override
public List<SingleParameter> getParameters() {
return null;
}
@Override
public String id() {
return "Stupid-Bug-Counter-Plugin";
}
@Override
public void runBeforeSimulation(StupidEnvironment env, ParCollection params) {
dataset = new DefaultCategoryDataset();
// chart = ChartFactory.createLineChart(
// "Bug count",
// "Simulation time",
// "Number of agents",
// dataset,
// PlotOrientation.VERTICAL,
// false,
// false,
// false);
// show = StaticMethods.showImage(chart.createBufferedImage(500, 500), "Line chart");
}
@Override
public void runAfterSimulation(StupidEnvironment env, ParCollection params) {
}
@Override
public void runDuringSimulation(StupidEnvironment env, Wink currentSimTime,
ParCollection params) {
// for (int d : numOfAgents) {
// series.add(i, d);
// i++;
// }
dataset.addValue((Number) env.getAgents().size(), "1", currentSimTime.getLastTick());
// chart = ChartFactory.createLineChart(
// "Bug count",
// "Simulation time",
// "Number of agents",
// dataset,
// PlotOrientation.VERTICAL,
// false,
// false,
// false);
// show.getPanel().setImg(chart.createBufferedImage(500, 500));
// show.getPanel().repaint();
}
@Override
public void handleEvent(EASEvent e, StupidEnvironment env,
Wink lastSimTime, ParCollection params) {
}
/* (non-Javadoc)
* @see eas.plugins.Plugin#getSupportedPlugins()
*/
@Override
public List<String> getSupportedPlugins() {
// TODO Auto-generated method stub
return null;
}
@Override
public void onSimulationResumed(StupidEnvironment env, Wink resumeTime,
ParCollection params) {
}
}