Class BugWorld

java.lang.Object
  extended byBugWorld
All Implemented Interfaces:
uwcse.graphics.GWindowEventHandler, MatrixController

public class BugWorld
extends java.lang.Object
implements MatrixController, uwcse.graphics.GWindowEventHandler

This class creates and manages an active surface for the Gobbler program.


Constructor Summary
BugWorld(int r, int c)
          Using the cell counts given, create a new window.
 
Method Summary
 void animate(int millis)
          Step the model continuously with a pause in between each step.
 void keyPressed(uwcse.graphics.GWindowEvent arg0)
           
 void keyReleased(uwcse.graphics.GWindowEvent arg0)
           
 void mouseDragged(uwcse.graphics.GWindowEvent arg0)
           
 void mousePressed(uwcse.graphics.GWindowEvent arg0)
           
 void mouseReleased(uwcse.graphics.GWindowEvent arg0)
           
 void step()
          Step the model one simulation step.
 void timerExpired(uwcse.graphics.GWindowEvent arg0)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BugWorld

public BugWorld(int r,
                int c)
Using the cell counts given, create a new window.

Parameters:
r - number of rows of cells
c - number of columns of cells
Method Detail

step

public void step()
Description copied from interface: MatrixController
Step the model one simulation step. This method is responsible in part for managing performance, so it should tell the views to suspend and resume repaints before and after the model is stepped.

Specified by:
step in interface MatrixController
See Also:
MatrixController.step()

animate

public void animate(int millis)
Description copied from interface: MatrixController
Step the model continuously with a pause in between each step. Stepping will continue until some other event brings it to a stop.

Specified by:
animate in interface MatrixController
Parameters:
millis - the number of milliseconds between each clock tick
See Also:
MatrixController.animate(int)

mousePressed

public void mousePressed(uwcse.graphics.GWindowEvent arg0)
Specified by:
mousePressed in interface uwcse.graphics.GWindowEventHandler
See Also:
GWindowEventHandler.mousePressed(uwcse.graphics.GWindowEvent)

mouseReleased

public void mouseReleased(uwcse.graphics.GWindowEvent arg0)
Specified by:
mouseReleased in interface uwcse.graphics.GWindowEventHandler
See Also:
GWindowEventHandler.mouseReleased(uwcse.graphics.GWindowEvent)

mouseDragged

public void mouseDragged(uwcse.graphics.GWindowEvent arg0)
Specified by:
mouseDragged in interface uwcse.graphics.GWindowEventHandler
See Also:
GWindowEventHandler.mouseDragged(uwcse.graphics.GWindowEvent)

timerExpired

public void timerExpired(uwcse.graphics.GWindowEvent arg0)
Specified by:
timerExpired in interface uwcse.graphics.GWindowEventHandler
See Also:
GWindowEventHandler.timerExpired(uwcse.graphics.GWindowEvent)

keyPressed

public void keyPressed(uwcse.graphics.GWindowEvent arg0)
Specified by:
keyPressed in interface uwcse.graphics.GWindowEventHandler
See Also:
GWindowEventHandler.keyPressed(uwcse.graphics.GWindowEvent)

keyReleased

public void keyReleased(uwcse.graphics.GWindowEvent arg0)
Specified by:
keyReleased in interface uwcse.graphics.GWindowEventHandler
See Also:
GWindowEventHandler.keyReleased(uwcse.graphics.GWindowEvent)