Class Tamagochi

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Tamagochi
All Implemented Interfaces:
java.lang.Runnable

public class Tamagochi
extends java.lang.Thread

An engine for the Tamagochi game.

Since:
JDK1.2

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void feed()
          Feeds the tamagochi.
static void main(java.lang.String[] args)
          This method gets called automatically when you run the Tamagochi application.
 void quit()
          Tells the tamagochi to quit.
 void run()
          This method gets called automatically when you run the Tamagochi application.
 void sleep()
          Makes the tamagochi go to sleep.
 void wake()
          Makes the tamagochi wake up.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

wake

public void wake()
Makes the tamagochi wake up.


sleep

public void sleep()
Makes the tamagochi go to sleep. When asleep, the Tamagochi gains one unit of health each time step.


feed

public void feed()
Feeds the tamagochi. This causes its energy to increase by one unit. You cannot feed the Tamagochi when it is asleep.


quit

public void quit()
Tells the tamagochi to quit.


run

public void run()
This method gets called automatically when you run the Tamagochi application. You should not call this method yourself.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

main

public static void main(java.lang.String[] args)
This method gets called automatically when you run the Tamagochi application. You should not call this method yourself.