A C D E F G H I L M N O P R S T U W

A

acquireFork(Philosopher) - Method in class Fork
Gives the fork to the philosopher requiring it.

C

createThreads() - Method in class DiningPhilosophers
Creates all philosophers.

D

decrementCountOfPhilosophers() - Method in class DiningPhilosophers
Decrements the count of philosophers present in the program.
DiningPhilosophers - class DiningPhilosophers.
Dining philosophers example.
DiningPhilosophers() - Constructor for class DiningPhilosophers
 
doIt(String[]) - Method in class DiningPhilosophers
If command line parameters are accepted, creates philosophers, lets them run and waits until they all finish.

E

eat() - Method in class Philosopher
Suspends the philosopher for a random number of seconds -- simulation of eaiting.

F

firstFork - Variable in class Philosopher
 
Fork - class Fork.
Every fork holds information about its owner -- the philosopher who currently uses it.
Fork() - Constructor for class Fork
Creates a new fork with no owner.
forks - Variable in class DiningPhilosophers
 

G

getLeftFork() - Method in class Philosopher
Returns the philosopher's left fork.
getOwner() - Method in class Fork
Returns the fork's owner.
getRightFork() - Method in class Philosopher
Returns the philosopher's right fork.
getState() - Method in class Philosopher
Returns the philosopher's state.

H

hello() - Method in class DiningPhilosophers
Prints out a hello message.

I

id - Variable in class Philosopher
 

L

leftFork - Variable in class Philosopher
 

M

main(String[]) - Static method in class DiningPhilosophers
Runs the program.

N

NO_OF_PHILOSOPHERS - Static variable in class Philosopher
 
NO_OF_STATES - Static variable in class Philosopher
 
NO_OF_TURNS - Static variable in class Philosopher
 
noOfLivingPhilosophers - Variable in class DiningPhilosophers
 

O

owner - Variable in class Fork
 

P

parent - Variable in class Philosopher
 
Philosopher - class Philosopher.
A philosopher spends its life by thinking and eating.
Philosopher(DiningPhilosophers, int, Fork, Fork, int, int) - Constructor for class Philosopher
Creates a new philosopher, with a unique ID.
philosophers - Variable in class DiningPhilosophers
 
printExplanation() - Method in class DiningPhilosophers
Prints out an explanation of symbols used during program output.
printForks() - Method in class DiningPhilosophers
Prints out a line describing the current state of forks and philosophers.

R

releaseFork(Philosopher) - Method in class Fork
Releases the fork and wakes up a blocked thread waiting for the fork, if there is any.
rightFork - Variable in class Philosopher
 
run() - Method in class Philosopher
Periodically thinks and eats.

S

secondFork - Variable in class Philosopher
 
setTimes(String[]) - Method in class DiningPhilosophers
Processes command line parameters.
state - Variable in class Philosopher
 
STATE_DEAD - Static variable in class Philosopher
 
STATE_EATING - Static variable in class Philosopher
 
STATE_RELEASING - Static variable in class Philosopher
 
STATE_THINKING - Static variable in class Philosopher
 
STATE_WAITING - Static variable in class Philosopher
 
STATES - Static variable in class Philosopher
 

T

think() - Method in class Philosopher
Suspends the philosopher for a random number of seconds -- simulation of thinking.
timeToEat - Variable in class DiningPhilosophers
 
timeToEat - Variable in class Philosopher
 
timeToThink - Variable in class DiningPhilosophers
 
timeToThink - Variable in class Philosopher
 

U

usage() - Method in class DiningPhilosophers
Prints out a message explaining program's usage.

W

waitForZeroPhilosophers() - Method in class DiningPhilosophers
Blocks until all philosophers finish their work.

A C D E F G H I L M N O P R S T U W