Class EmissionApplet.Photon

java.lang.Object
  |
  +--EmissionApplet.Photon
Enclosing class:
EmissionApplet

public class EmissionApplet.Photon
extends java.lang.Object
implements java.lang.Cloneable

Models a photon


Field Summary
protected  boolean dead
          true if this photon has been absorbed, else false
protected  int phase
           
protected  double x
           
protected  double y
           
 
Constructor Summary
EmissionApplet.Photon(double x)
          Creates a new photon with random phase and y position
EmissionApplet.Photon(double x, double y)
          Creates a new photon with random phase
 
Method Summary
 java.lang.Object clone()
          Creates a duplicate of this photon, with the same x coordinate and phase, but a random y position.
 void die()
          Indicates that this photon has been absorbed
 boolean isFinished()
           
 void paint(java.awt.Graphics g, double xscl, double yscl)
          Displays this photon
 void update(double dt)
          Advances this photon through time by the specified interval
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dead

protected boolean dead
true if this photon has been absorbed, else false

x

protected double x

y

protected double y

phase

protected int phase
Constructor Detail

EmissionApplet.Photon

public EmissionApplet.Photon(double x,
                             double y)
Creates a new photon with random phase
Parameters:
x - The starting x coordinate
y - The starting y coordinate

EmissionApplet.Photon

public EmissionApplet.Photon(double x)
Creates a new photon with random phase and y position
Parameters:
x - The starting x coordinate
Method Detail

clone

public java.lang.Object clone()
Creates a duplicate of this photon, with the same x coordinate and phase, but a random y position.
Overrides:
clone in class java.lang.Object

paint

public void paint(java.awt.Graphics g,
                  double xscl,
                  double yscl)
Displays this photon
Parameters:
g - The Graphics surface on which to paint
xscl - Multiplier to convert simulation x coordinates to screen coordinates
yscl - Multiplier to convert simulation y coordinates to screen coordinates

update

public void update(double dt)
Advances this photon through time by the specified interval

isFinished

public boolean isFinished()
Returns:
true if this photon has been absorbed or has otherwise left the simulation, else false

die

public void die()
Indicates that this photon has been absorbed