|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--java.applet.Applet
|
+--BaseApplet
|
+--BaseApplet2
|
+--EmissionApplet
Displays an animated diagram to illustrate absorption, emission (spontaneous and stimulated) and pumping.
| Inner Class Summary | |
class |
EmissionApplet.Electron
Models an electron |
class |
EmissionApplet.Photon
Models a photon |
| Inner classes inherited from class BaseApplet2 |
BaseApplet2.FixedButton,
BaseApplet2.FixedCheckbox,
BaseApplet2.GraphClickListener |
| Inner classes inherited from class BaseApplet |
BaseApplet.MozillaWorkaround,
BaseApplet.ResizeListener |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AWTTreeLock |
| Field Summary | |
protected double |
absorb
Probability that a passing photon will be absorbed by a particular electron |
protected java.awt.TextField |
absorbField
|
protected java.awt.Button |
destroy
|
protected boolean |
destroyPhotons
Indicates that on the next logic cycle, all photons should be culled |
protected double |
dt
The rate of advancement of simulation time |
protected EmissionApplet.Electron[] |
electrons
An array of all the electrons in the simulation |
protected double |
electronSpeed
The ratio of electron speed to photon speed |
protected double |
emit
Probability that a passing photon will trigger an emission from a particular electron |
protected java.awt.TextField |
emitField
|
protected java.awt.Button |
exciteAll
|
protected int |
excitedY
The y coordinate at which excited electrons should be drawn |
protected java.awt.Button |
exciteNone
|
protected double |
hGap
The width (in simulation units) of the spacing between electrons |
protected int |
hMargin
|
protected java.awt.TextField |
inversionField
|
protected java.awt.Button |
invert
|
protected double |
margin
Proportion of the simulation reserved at the top and bottom for electrons. |
protected int |
normalY
The y coordinate at which non-excited electrons should be drawn |
protected java.util.Vector |
photons
A list of all the photons in the simulation |
protected double |
pump
Average proportion of non-excited electrons which will be pumped to the upper energy level in the time it takes for a photon to pass through the simulation. |
protected java.awt.TextField |
pumpField
|
protected double |
simH
The width (in simulation units) of the simulation |
protected double |
simW
The width (in simulation units) of the simulation |
protected int[] |
sinTable
Cache of sine values |
protected double |
spont
Average proportion of excited electrons which will spontaneously emit a photon in the time it takes for a photon to pass through the simulation. |
protected java.awt.TextField |
spontField
|
protected java.lang.Thread |
thr
The thread used to perform the work of the simulation |
protected int |
vMargin
|
protected int |
waveDispLen
|
| Fields inherited from class BaseApplet2 |
boxes,
buttons,
enablePrompt,
fields,
focus,
panel,
statusLabel,
useSwing,
V_MARGIN |
| Fields inherited from class BaseApplet |
buffer,
GRAPH_MARGIN,
refresh,
resizeListener,
safetyLimit,
useBuffer |
| Fields inherited from class java.applet.Applet |
serialVersionUID,
stub |
| Fields inherited from class java.awt.Panel |
base,
nameCounter,
serialVersionUID |
| Fields inherited from class java.awt.Container |
component,
containerListener,
containerSerializedDataVersion,
dispatcher,
layoutMgr,
maxSize,
ncomponents,
serialVersionUID |
| Fields inherited from class java.awt.Component |
actionListenerK,
adjustmentListenerK,
appContext,
assert,
background,
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
changeSupport,
componentListener,
componentListenerK,
componentOrientation,
componentSerializedDataVersion,
containerListenerK,
cursor,
dropTarget,
enabled,
eventMask,
focusListener,
focusListenerK,
font,
foreground,
hasFocus,
height,
incRate,
inputMethodListener,
inputMethodListenerK,
isInc,
isPacked,
itemListenerK,
keyListener,
keyListenerK,
LEFT_ALIGNMENT,
locale,
LOCK,
minSize,
mouseListener,
mouseListenerK,
mouseMotionListener,
mouseMotionListenerK,
name,
nameExplicitlySet,
newEventsOnly,
ownedWindowK,
parent,
peer,
peerFont,
popups,
prefSize,
RIGHT_ALIGNMENT,
serialVersionUID,
textListenerK,
TOP_ALIGNMENT,
valid,
visible,
width,
windowListenerK,
x,
y |
| Constructor Summary | |
EmissionApplet()
|
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent ae)
Subclasses should at least provide an empty implementation of this method. |
protected void |
addFields()
Adds the text fields to the GUI |
void |
buildSineTable(int len,
int amp)
Creates a table of sine values (for painting the photons as waves). |
double |
calcInversion()
Measures the population inversion (the proportion of electrons at the upper energy level. |
void |
createElectrons()
Part of initialisation; creates a row of electrons, with spacing determined by hGap. |
protected int |
cullPhotons()
Removes from the list any photons which have left the simulation. |
void |
destroyPhotons()
Causes all photons in the simulation to be destroyed |
void |
doPaint(java.awt.Graphics g)
Called by forcePaint() to actually
perform the painting. |
protected EmissionApplet.Electron |
findElectron(double left,
double right)
Finds the first electron within a specified interval. |
void |
init()
Performs extra initialisation, including adding a panel to the bottom of the applet. |
void |
invert()
Applys the selected inversion to the electrons. |
void |
killAnim()
Requests that the currently running simulation should stop at the next opportunity. |
protected void |
paintElectrons(java.awt.Graphics g,
double xscl,
double yscl)
Paints all the electrons in the simulation. |
protected void |
paintPhotons(java.awt.Graphics g,
double xscl,
double yscl)
Paints all the photons in the simulation. |
protected void |
paintWave(java.awt.Graphics g,
int x,
int y,
int amp,
double wavelength,
int phase)
Paints a sine wave to represent a photon. |
void |
run()
Performs the work of the simulation: an update/repaint loop. |
void |
setAllExcited(boolean b)
Sets all the electrons to either the upper or lower energy level. |
int |
sin(int x)
Looks up the sin value to use for a particular x. |
void |
spawnPhoton()
Creates a new photon at the "start" end of the simulation, with random vertical position (of no real consequence), and random phase. |
void |
start()
Applets should use this method to perform any final initialisation necessary to "activate" the applet |
void |
startAnim()
Requests that the simulation be started. |
void |
stop()
When this method is called, the applet should cease any user interaction. |
void |
updateElectrons(double dt)
Calls the update() method of every
electron, thus advancing them through the specified time interval. |
void |
updateInput()
Reads in (and validates) input from the text fields. |
void |
updatePhotons(double dt)
Calls the update() method of every
photon, thus advancing them through the specified time interval. |
| Methods inherited from class BaseApplet2 |
add,
add,
addButton,
addCheckbox,
addField,
addField,
addField,
addListeners,
focusGained,
focusLost,
getDouble,
getGraphHeight,
getInt,
lockControls,
makeButton,
makePanel,
paintDashedLineH,
paintDashedLineV,
register,
removeListeners,
setComponentsEnabled,
setLayout,
setPromptEnabled,
textValueChanged,
toString,
unlockControls |
| Methods inherited from class BaseApplet |
changeFont,
forcePaint,
getAppletInfo,
getParameterInfo,
itemStateChanged,
paint,
refresh,
update |
| Methods inherited from class java.applet.Applet |
destroy,
getAppletContext,
getAudioClip,
getAudioClip,
getCodeBase,
getDocumentBase,
getImage,
getImage,
getLocale,
getParameter,
isActive,
newAudioClip,
play,
play,
resize,
resize,
setStub,
showStatus |
| Methods inherited from class java.awt.Panel |
|
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
addContainerListener,
addImpl,
applyOrientation,
countComponents,
deliverEvent,
dispatchEventImpl,
dispatchEventToSelf,
doLayout,
eventEnabled,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents_NoClientCode,
getComponents,
getCursorTarget,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getMouseEventTarget,
getPreferredSize,
getWindow,
initIDs,
insets,
invalidate,
invalidateTree,
isAncestorOf,
layout,
lightweightPrint,
list,
list,
locate,
minimumSize,
nextFocus,
paintComponents,
paramString,
postProcessKeyEvent,
postsOldMouseEvents,
preferredSize,
preProcessKeyEvent,
print,
printComponents,
printOneComponent,
processContainerEvent,
processEvent,
proxyEnableEvents,
proxyRequestFocus,
readObject,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setCursor,
setFocusOwner,
setFont,
transferFocus,
updateCursor,
validate,
validateTree,
writeObject |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
areInputMethodsEnabled,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont_NoClientCode,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getIntrinsicCursor,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getNativeContainer,
getParent_NoClientCode,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getToolkitImpl,
getTreeLock,
getWidth,
getWindowForObject,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isEnabledImpl,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
| Field Detail |
protected boolean destroyPhotons
protected double absorb
protected double emit
protected double spont
protected double pump
protected java.lang.Thread thr
protected java.util.Vector photons
protected EmissionApplet.Electron[] electrons
protected double simW
protected double simH
protected double hGap
protected double dt
protected double electronSpeed
protected double margin
protected int excitedY
protected int normalY
protected int waveDispLen
protected int hMargin
protected int vMargin
protected int[] sinTable
protected java.awt.TextField absorbField
protected java.awt.TextField emitField
protected java.awt.TextField spontField
protected java.awt.TextField inversionField
protected java.awt.TextField pumpField
protected java.awt.Button exciteAll
protected java.awt.Button exciteNone
protected java.awt.Button invert
protected java.awt.Button destroy
| Constructor Detail |
public EmissionApplet()
| Method Detail |
public void init()
protected void addFields()
public void start()
public void stop()
start().public void doPaint(java.awt.Graphics g)
forcePaint() to actually
perform the painting. Subclasses should implement this method as if
it were the standard paint() method; buffering will
then take place transparently.g - The Graphics object on which to paint
protected void paintPhotons(java.awt.Graphics g,
double xscl,
double yscl)
g - The Graphics surface on which to paintxscl - Multiplier to convert simulation x coordinates
to screen coordinatesyscl - Multiplier to convert simulation y coordinates
to screen coordinates
protected void paintElectrons(java.awt.Graphics g,
double xscl,
double yscl)
g - The Graphics surface on which to paintxscl - Multiplier to convert simulation x coordinates
to screen coordinatesyscl - Multiplier to convert simulation y coordinates
to screen coordinatespublic void updateInput()
public void actionPerformed(java.awt.event.ActionEvent ae)
public void createElectrons()
hGap. Any prior existing electrons will
be lost; all newly created electrons will be at the lower energy
level.public void updatePhotons(double dt)
update() method of every
photon, thus advancing them through the specified time interval.
If there are currently no photons in the simulation, spawnPhoton() will be called to create one.public void updateElectrons(double dt)
update() method of every
electron, thus advancing them through the specified time interval.protected int cullPhotons()
public void spawnPhoton()
public void run()
public void startAnim()
public void killAnim()
public void buildSineTable(int len,
int amp)
len - The wavelength, in pixelsamp - The amplitude, in pixelspublic int sin(int x)
buildSineTable(), it's much faster than Math.sin().
protected void paintWave(java.awt.Graphics g,
int x,
int y,
int amp,
double wavelength,
int phase)
g - The Graphics surface on which to paintx - The x coordinate of the leading end of the wavey - The y coordinate of the leading end of the waveamp - ignored; all waves now use the cached sine tablewavelength - used only to determine how much wave to draw.phase - The phase shift for the wave
protected EmissionApplet.Electron findElectron(double left,
double right)
public void setAllExcited(boolean b)
b - true if all electrons should be excited,
false if all electrins should be unexcited
(bored?)public void invert()
public double calcInversion()
public void destroyPhotons()
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||