net.mazewar
Class Maze

java.lang.Object
  extended by net.mazewar.Maze
Direct Known Subclasses:
MazeImpl

public abstract class Maze
extends java.lang.Object

An abstract class for representing mazes, and the operations a Client in the Maze may wish to perform..

Version:
$Id: Maze.java 343 2004-01-24 03:43:45Z geoffw $
Author:
Geoffrey Washburn <geoffw@cis.upenn.edu>

Constructor Summary
Maze()
           
 
Method Summary
abstract  void addClient(Client client)
          Add a Client at random location in the Maze.
abstract  void addClientAtGivenPoint(Client client, DirectedPoint directedPoint)
           
abstract  void addMazeListener(MazeListener ml)
          Register an object that wishes to be notified when the maze changes
abstract  boolean checkBounds(Point point)
          Check whether a Point is within the bounds of the Maze.
abstract  boolean clientFire(Client client)
          Create a new Projectile from the specified Client
abstract  Cell getCell(Point point)
          Obtain the Cell corresponding to a given Point in the Maze.
abstract  Direction getClientOrientation(Client client)
          Find out the cardinal direction a Client is facing.
abstract  Point getClientPoint(Client client)
          Find out where a specified Client is located in the Maze.
abstract  java.util.Iterator getClients()
          Obtain an Iterator over all Clients in the Maze
abstract  Point getSize()
          Obtain a Point describing the size of the Maze.
abstract  boolean moveClientBackward(Client client)
          Attempt to move a Client in the Maze backward.
abstract  boolean moveClientForward(Client client)
          Attempt to move a Client in the Maze forward.
abstract  void removeClient(Client client)
          Remove the specified Client from the Maze
abstract  void removeMazeListener(MazeListener ml)
          Remove an object from the notification queue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Maze

public Maze()
Method Detail

getSize

public abstract Point getSize()
Obtain a Point describing the size of the Maze.

Returns:
A Point where the method getX returns the maximum X coordintate, and the method getY returns the maximum Y coordinate.

checkBounds

public abstract boolean checkBounds(Point point)
Check whether a Point is within the bounds of the Maze.

Returns:
true if the point lies within the Maze, false otherwise.

getCell

public abstract Cell getCell(Point point)
Obtain the Cell corresponding to a given Point in the Maze.

Parameters:
point - Location in the Maze.
Returns:
A Cell describing that location.

addClient

public abstract void addClient(Client client)
Add a Client at random location in the Maze.

Parameters:
client - Client to be added to the Maze.

clientFire

public abstract boolean clientFire(Client client)
Create a new Projectile from the specified Client

Parameters:
client - Client that is firing.
Returns:
false on failure, true on success.

removeClient

public abstract void removeClient(Client client)
Remove the specified Client from the Maze

Parameters:
client - Client to be removed.

getClientPoint

public abstract Point getClientPoint(Client client)
Find out where a specified Client is located in the Maze.

Parameters:
client - The Client being located.
Returns:
A Point describing the location of the client.

getClientOrientation

public abstract Direction getClientOrientation(Client client)
Find out the cardinal direction a Client is facing.

Parameters:
client - The Client being queried.
Returns:
The orientation of the specific Client as a Direction.

moveClientForward

public abstract boolean moveClientForward(Client client)
Attempt to move a Client in the Maze forward.

Parameters:
client - Client to move.
Returns:
true if successful, false if failure.

moveClientBackward

public abstract boolean moveClientBackward(Client client)
Attempt to move a Client in the Maze backward.

Parameters:
client - Client to move.
Returns:
true if successful, false if failure.

getClients

public abstract java.util.Iterator getClients()
Obtain an Iterator over all Clients in the Maze

Returns:
Iterator over clients in the Maze.

addMazeListener

public abstract void addMazeListener(MazeListener ml)
Register an object that wishes to be notified when the maze changes

Parameters:
ml - An object implementing the MazeListener interface.

removeMazeListener

public abstract void removeMazeListener(MazeListener ml)
Remove an object from the notification queue

Parameters:
ml - An object implementing the MazeListener interface.

addClientAtGivenPoint

public abstract void addClientAtGivenPoint(Client client,
                                           DirectedPoint directedPoint)