|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.SwingWorker<java.lang.String,java.lang.String>
com.avian.birds.basebirds.AbstractBasicBird
com.avian.birds.basebirds.StdBird
com.avian.birds.philos.Phil1
public class Phil1
A type of StdBird that is good at philosophizing but not so good at chatting. He shares forks with the philosophers seated at his immediate left and right. He tries to pick up a fork (left or right) and then tries to get the other one. Rules: He can only eat when he has both forks. When he has both forks, he eats for a random length of time and then puts down both forks. When he has one fork, he tries 3 times to pick up the other fork after waiting for random intervals between each attempt. If he cannot get the other fork after 3 tries, he puts down the fork that he was holding and then waits for a random length of time before trying again.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.SwingWorker |
---|
javax.swing.SwingWorker.StateValue |
Field Summary |
---|
Fields inherited from class com.avian.birds.basebirds.StdBird |
---|
foodFromTree, healthStatus, jbRefStart, jlRefLastAte, jtaRefHistory, jtfRefHealth, mts, myTupleTree, nts, sampleXmv, startButtonText |
Fields inherited from class com.avian.birds.basebirds.AbstractBasicBird |
---|
bhf, bif, birdDesc, birdHistory, birdName, bof, eatsFood, hatchTime, historyFileName, inputFileName, lastAte, levelOfInfo, lifeTime, napLength, outputFileName, stamina, stopNow, storesFood |
Constructor Summary | |
---|---|
Phil1()
|
Method Summary | |
---|---|
void |
digest()
Provides the processing functionality for this Bird. |
void |
eatFood()
Every Philosopher Bird must eat food to stay alive and this method provides the instructions that this Bird will follow to eat. |
void |
storeFood()
Need to put back any forks that we are holding |
Methods inherited from class com.avian.birds.basebirds.StdBird |
---|
checkAge, done, setHealthRef, setHealthStatus, setHistoryAreaRef, setJlRefLastAte, setStartButtonRef, setStartButtonText, setTupleTree |
Methods inherited from class com.avian.birds.basebirds.AbstractBasicBird |
---|
addToBirdHistory, doInBackground, getAuxFood, getBirdDescription, getBirdHistory, getBirdName, getEatsFood, getHatchTime, getHistoryFileName, getInputFileName, getLastAte, getLevelOfInfo, getLifeTime, getNameOfFoodToStore, getNapLength, getOutputFileName, getStamina, isStopNow, setBhf, setBif, setBirdDesc, setBirdHistory, setBirdName, setBof, setEatsFood, setHatchTime, setHistoryFileName, setInputFileName, setLevelOfInfo, setLevelOfInfo, setLifeTime, setNapLength, setOutputFileName, setStamina, setStopNow, setStoresFood |
Methods inherited from class javax.swing.SwingWorker |
---|
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Phil1()
Method Detail |
---|
public void eatFood()
eatFood
in class StdBird
public void digest()
digest
in class StdBird
public void storeFood()
storeFood
in class StdBird
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |