Class Diffusion.Electron

java.lang.Object
  |
  +--Diffusion.Electron
Enclosing class:
Diffusion

public class Diffusion.Electron
extends java.lang.Object

Class to simulate a single electron


Field Summary
(package private)  double x
           
(package private)  double xv
           
(package private)  double y
           
(package private)  double yv
           
 
Constructor Summary
Diffusion.Electron(double x, double y, double energy)
          Creates a new electron, with the specified energy, but a random direction.
Diffusion.Electron(double x, double y, double xv, double yv)
          Creates a new electron
 
Method Summary
 void paint(java.awt.Graphics g, double xscl, double yscl)
          Plots this electron (as a filled circle).
 void update(double dt)
          Updates the position and velocity of this electron to reflect a change in time.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

x

double x

y

double y

xv

double xv

yv

double yv
Constructor Detail

Diffusion.Electron

public Diffusion.Electron(double x,
                          double y,
                          double xv,
                          double yv)
Creates a new electron
Parameters:
x - The initial x-coordinate
y - The initial y-coordinate
xv - The initial x component of the velocity
yv - The initial y component of the velocity

Diffusion.Electron

public Diffusion.Electron(double x,
                          double y,
                          double energy)
Creates a new electron, with the specified energy, but a random direction.
Parameters:
x - The initial x-coordinate
y - The initial y-coordinate
energy - The energy of the electron
Method Detail

paint

public void paint(java.awt.Graphics g,
                  double xscl,
                  double yscl)
Plots this electron (as a filled circle).
Parameters:
g - The Graphics surface on which to paint
xscl - The scaling factor for x coordinates
yscl - The scaling factor for y coordinates

update

public void update(double dt)
Updates the position and velocity of this electron to reflect a change in time. If the particle hits a wall, the appropriate momentum component will be negated.