Class NuclearPlant
Class NuclearPlant
java.lang.Object
   |
   +----browser.Applet
           |
           +----NuclearPlant
- 
class 
NuclearPlant
- 
extends Applet
- 
implements Runnable
   
The class NuclearPlant is an applet that lets you run a nuclear power plant
- 
Version:
 - 
1.0
 - 
Author:
 - 
Henrik Eriksson
 
- 
background
 - 
The static background image
 - 
im
 - 
The offscreen image
 - 
kicker
 - 
The thread that updates the display (for animation)
 - 
kickerDelay
 - 
The amount of time too sleep between display updates (ms?)
 - 
offscreen
 - 
The offscreen graphics context
 
- 
NuclearPlant()
 - 
 
- 
blow(Component)
 - 
Blow up a device.
 - 
crashSound(int)
 - 
Play a crash sound.
 - 
destroy()
 - 
Destroy the applet.
 - 
init()
 - 
Initialize the applet.
 - 
mouseDown(int, int)
 - 
Handle mouseDown events.
 - 
mouseDrag(int, int)
 - 
Handle mouseDrag events.
 - 
mouseUp(int, int)
 - 
Handle mouseUp events.
 - 
paint(Graphics)
 - 
Update the plant display
 - 
rotatePumps()
 - 
Rotate the pumps one step.
 - 
run()
 - 
Run the animation thread.
 - 
start()
 - 
Start the applet.
 - 
startReactor()
 - 
Start the simulation
 - 
stop()
 - 
Stop the applet.
 - 
stopReactor()
 - 
Stop the simulation
 - 
timeStep(int)
 - 
Run the simulation n steps.
 - 
update(Graphics)
 - 
Update without erasing background
 - 
waterWave()
 - 
Move the waves on the water surfaces in the tanks
 
kicker
  protected Thread kicker
- 
The thread that updates the display (for animation)
 
kickerDelay
  protected int kickerDelay
- 
The amount of time too sleep between display updates (ms?)
 
im
  protected Image im
- 
The offscreen image
 
offscreen
  protected Graphics offscreen
- 
The offscreen graphics context
 
background
  protected Image background
- 
The static background image
 
NuclearPlant
  public NuclearPlant()
init
  public void init()
- 
Initialize the applet. Sets the applet size, creates
                  the plant components, and creates the simulator.
- 
Overrides:
 - 
init in class Applet
 
 
paint
  public void paint(Graphics g)
- 
Update the plant display
- 
Parameters:
 - 
g
-
 Graphics context to paint in
 - 
Overrides:
 - 
paint in class Applet
 
 
update
  public void update(Graphics g)
- 
Update without erasing background
- 
Parameters:
 - 
g
-
 Graphics context to update in
 - 
Overrides:
 - 
update in class Applet
 
 
mouseDown
  public void mouseDown(int x,
                        int y)
- 
Handle mouseDown events. This method distributes the
                  message by calling the mouseDown methods for the
                  appropriate plant components
- 
Parameters:
 - 
x
-
 The X coordinate
- 
y
-
 The Y coordinate
  - 
Overrides:
 - 
mouseDown in class Applet
 
 
mouseDrag
  public void mouseDrag(int x,
                        int y)
- 
Handle mouseDrag events. This method distributes the
                  message by calling the mouseDrag methods for the
                  appropriate plant components
- 
Parameters:
 - 
x
-
 The X coordinate
- 
y
-
 The Y coordinate
  - 
Overrides:
 - 
mouseDrag in class Applet
 
 
mouseUp
  public void mouseUp(int x,
                      int y)
- 
Handle mouseUp events. This method distributes the
                  message by calling the mouseUp methods for the
                  appropriate plant components
- 
Parameters:
 - 
x
-
 The X coordinate
- 
y
-
 The Y coordinate
  - 
Overrides:
 - 
mouseUp in class Applet
 
 
rotatePumps
  protected void rotatePumps()
- 
Rotate the pumps one step. (Only pumps with rpm > 0
                  are rotated.)
 
waterWave
  protected void waterWave()
- 
Move the waves on the water surfaces in the tanks
 
startReactor
  public void startReactor()
- 
Start the simulation
 
timeStep
  public void timeStep(int n)
- 
Run the simulation n steps. Uses the crurrent
simulator to calculate the next states
- 
Parameters:
 - 
n
-
 The number of steps
 
 
blow
  public void blow(Component device)
- 
Blow up a device. 
- 
Parameters:
 - 
device
-
 The device to blow (e.g., a turbine object)
 
 
stopReactor
  public void stopReactor()
- 
Stop the simulation
 
crashSound
  public void crashSound(int n)
- 
Play a crash sound. This method is called when plant
                  components blow up.
- 
Parameters:
 - 
n
-
 Duration
 
 
run
  public void run()
- 
Run the animation thread. This method is called when
                  the animation thread is started.
 
start
  public void start()
- 
Start the applet. Creates the animation thread and
                  opens the window for the sequence control buttons
- 
Overrides:
 - 
start in class Applet
 
 
stop
  public void stop()
- 
Stop the applet. Stops the animation thread and
                  closes the window for the sequence control buttons
- 
Overrides:
 - 
stop in class Applet
 
 
destroy
  public void destroy()
- 
Destroy the applet. This method is called by the
                  browser when the applet is destroyed. It disposes
                  the window for the sequence control buttons.
- 
Overrides:
 - 
destroy in class Applet