Class Program

java.lang.Object
itumulator.executable.Program

public class Program extends Object
Sets up the program to run simulations. The Program will handle creation of World, Simulator, Canvas, Frame and correctly connect these. As such, one can instantiate a single Program and access relevant objects through this, as well as running the simulation. The Program contains two views (changable by clicking the topic right button). It defaults to the isomorphic 2.5d perspective, unless the size of the map exceeds 20.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Program(int size, int display_size, int delay)
    Produces a new program.
  • Method Summary

    Modifier and Type
    Method
    Description
    Provides the canvas itself, responsible for drawing contents (Not necessary to execute the simulation).
    int
    Get the current delay (in ms)
    Provides the frame itself, responsible for buttons (Not necessary to execute the simulation).
    Provides the simulator itself, responsible for execution of simulations (Not necessary to execute the simulation).
    int
    Provides the size of the world
    Provides the world which this program concerns itself with.
    void
    run()
    Executes rounds of simulation using the delay (in ms) given.
    void
    setDelay(int delay)
    Adjust the delay (in ms) between run executions
    void
    Decide on the graphical representation of objects when shown within the GUI.
    void
    Used to initially show the graphical interface.
    void
    Executes a single 'step' of simulation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Program

      public Program(int size, int display_size, int delay)
      Produces a new program.
      Parameters:
      size - the size of the world to render (will be square).
      display_size - of the graphical window.
      delay - inbetween simulation steps when running run().
  • Method Details

    • getWorld

      public World getWorld()
      Provides the world which this program concerns itself with. Using this world object you can add new actors to the world.
      Returns:
      World wherein one can add elements to simulate.
    • getSimulator

      public Simulator getSimulator()
      Provides the simulator itself, responsible for execution of simulations (Not necessary to execute the simulation).
      Returns:
      Simulator
    • getCanvas

      public Canvas getCanvas()
      Provides the canvas itself, responsible for drawing contents (Not necessary to execute the simulation).
      Returns:
      Canvas.
    • getFrame

      public Frame getFrame()
      Provides the frame itself, responsible for buttons (Not necessary to execute the simulation).
      Returns:
      Frame.
    • getSize

      public int getSize()
      Provides the size of the world
      Returns:
      int representing both x and y dimensions.
    • show

      public void show()
      Used to initially show the graphical interface.
    • simulate

      public void simulate()
      Executes a single 'step' of simulation.
    • run

      public void run()
      Executes rounds of simulation using the delay (in ms) given.
    • setDelay

      public void setDelay(int delay)
      Adjust the delay (in ms) between run executions
      Parameters:
      delay - in ms
    • getDelay

      public int getDelay()
      Get the current delay (in ms)
      Returns:
      int.
    • setDisplayInformation

      public void setDisplayInformation(Class cl, DisplayInformation di)
      Decide on the graphical representation of objects when shown within the GUI.
      Parameters:
      cl - is the class which to associate a given display type with (can be accessed by writing [ClassName].class).
      di - the DisplayInformation to associate the type of object with.