All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface com.monpetitcoin.java.PrisonerGame.Pawn

public abstract interface Pawn
This interface defines how a class should behave if it wants to be considered as a Pawn. The main reason for Pawns is to be set as elements in a GameBoard.

Version:
1.00, 22 August 2001
Author:
François Suter
See Also:
com.monpetitcoin.java.GameBoard

Method Index

 o draw(Graphics, int, int, int, int)
This method draws the Pawn, given a position and a size.
 o getID()
Each Pawn is expected to have some number that identifies uniquely.
 o setNeighbors(Pawn[])
This method sets the list of neighbors for the Pawn.

Methods

 o draw
 public abstract void draw(java.awt.Graphics g,
                           int x,
                           int y,
                           int width,
                           int height)
This method draws the Pawn, given a position and a size. Note that the point is not necessarily an origin or a corner of the Pawn. Each implementation of the Pawn interface should define what it uses this point for. In the same way width and height may just define a bouding box for the Pawn and not its actual size.

Parameters:
g - the Graphics context for drawing the Pawn
x - the x-coordinate of a point of reference for drawing the Pawn
y - the y-coordinate of a point of reference for drawing the Pawn
width - the horizontal dimension of the Pawn
height - the vertical dimension of the Pawn
 o getID
 public abstract int getID()
Each Pawn is expected to have some number that identifies uniquely. This method returns such number.

Returns:
Pawn ID number
 o setNeighbors
 public abstract void setNeighbors(com.monpetitcoin.java.PrisonerGame.Pawn theNeighbors[])
This method sets the list of neighbors for the Pawn. This list is normally provided by the GameBoard.

Parameters:
theNeighbors - an array containing the list of neighbors, as references to Pawn objects
See Also:
setNeighborsLists

All Packages  Class Hierarchy  This Package  Previous  Next  Index