Class Person

java.lang.Object
   |
   +----Person

public class Person
extends Object
implements Runnable
The Person class represents a person as part of the Bridges simulation. A Person is a Runnable object, meaning that it can be run as a separate thread. The only goal in life of a person is to get to the other side of the river. (Perhaps it should be called a chicken?)

See Also:
Bridges

Constructor Index

 o Person(Bridges, int)
Construct a Person trying to cross a particular river in a particular direction.

Method Index

 o run()
Try to get across the river.
 o toString()
Returns a string representation of the Person.

Constructors

 o Person
 public Person(Bridges river,
               int direction)
Construct a Person trying to cross a particular river in a particular direction.

Parameters:
river - a Bridges object representing a river with bridges over it.
direction - the desired direction to cross -- one of GOEAST or GOWEST.
See Also:
GOEAST, GOWEST

Methods

 o toString
 public String toString()
Returns a string representation of the Person.

Returns:
a string representation of this Person object.
Overrides:
toString in class Object
 o run
 public void run()
Try to get across the river. Print a message when starting and another after successfully crossing. This procedures returns (causing the thread that is running it to terminate) after it prints the second message.