sim
Interface MatrixView

All Known Implementing Classes:
BugWorldView

public interface MatrixView

This interface is implemented by any class that wishes to provide a view of a MatrixModel.


Method Summary
 void addCritter(Critter bug, int[] curLoc)
          Add the given Critter to the collection of Critters we are displaying.
 uwcse.graphics.GWindow getGWindow()
          Get the GWindow associated with this view for use by a MatrixController.
 void moveCritter(Critter bug, int[] newLoc)
          Update the display to reflect a new position for the given Critter.
 void removeCritter(Critter bug)
          Remove the given Critter from the collection of Critters we are displaying.
 void resumeRepaints()
          Resume repainting this view's window.
 void suspendRepaints()
          Suspend repainting this view's window because we are going to do a bunch of updates.
 

Method Detail

getGWindow

public uwcse.graphics.GWindow getGWindow()
Get the GWindow associated with this view for use by a MatrixController.

Returns:
the GWindow associated with this view, or null if no window.

addCritter

public void addCritter(Critter bug,
                       int[] curLoc)
Add the given Critter to the collection of Critters we are displaying. If the Critter is already in the collection, the request is ignored. Note that a cell location is not the same as a pixel location. One of the tasks that a MatrixView does is translate between the cell location and the screen location.

Parameters:
bug - the Critter to add
curLoc - a 2-element int array containing the current cell location of this Critter. The row address is in element [0] and the column address is in element [1].

removeCritter

public void removeCritter(Critter bug)
Remove the given Critter from the collection of Critters we are displaying.

Parameters:
bug - the Critter to remove

moveCritter

public void moveCritter(Critter bug,
                        int[] newLoc)
Update the display to reflect a new position for the given Critter. Note that a cell location is not the same as a pixel location. One of the tasks that a MatrixView does is translate between the cell location and the screen location.

Parameters:
bug - the Critter to move
newLoc - a 2-element int array containing the new cell location of this Critter. The row address is in element [0] and the column address is in element [1].

suspendRepaints

public void suspendRepaints()
Suspend repainting this view's window because we are going to do a bunch of updates.


resumeRepaints

public void resumeRepaints()
Resume repainting this view's window.