|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet javax.swing.JApplet edu.uah.math.experiments.Experiment
public class Experiment
This class defines a basic, discrete time stochastic process that can be subclassed.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JApplet |
---|
javax.swing.JApplet.AccessibleJApplet |
Nested classes/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected javax.swing.JApplet |
applet
|
protected javax.swing.JPanel |
componentPanel
|
static java.awt.Color |
GREEN
|
static java.awt.Color |
RED
|
protected boolean |
showModelDistribution
|
javax.swing.JComboBox |
stopChoice
|
int |
stopCount
|
int |
stopFreq
|
boolean |
stopNow
|
int |
time
|
javax.swing.Timer |
timer
|
protected javax.swing.JPanel |
toolBars
|
int |
toolIndex
|
int |
updateCount
|
int |
updateFreq
|
Fields inherited from class javax.swing.JApplet |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Experiment()
|
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
This method handles the action events associated with the simulation buttons. |
void |
addComponent(java.awt.Component c,
int x,
int y,
int w,
int h)
This method adds a component to the component panel at a specified row and column, with a specified row span and column span, and with default horizontal and vertical weights. |
void |
addComponent(java.awt.Component c,
int x,
int y,
int w,
int h,
int f)
This method adds a component to the component panel at a specified row and column, with a specified row span and column span, and specified fill parameter. |
void |
addComponent(java.awt.Component c,
int x,
int y,
int w,
int h,
int wx,
int wy)
This method adds a component to the component panel at a specified row and column, specified row span and column span, and specified horizontal and vertical weights. |
void |
addTool(java.awt.Component c)
This method adds a tool to the main toolbar, in the next to the last position (just before the About button). |
void |
addToolBar(java.awt.Component c)
This method adds a new component to the toolbar panel. |
void |
clearToolBars()
|
void |
doExperiment()
This method defines what the experiment actually does, and should be overridden, when this class is subclassed, to define an actual random pocess. |
java.lang.String |
format(double x)
This method formats a number as a string in a specified way. |
java.lang.String |
getAppletInfo()
This method returns basic copyright, author, and other metadata information. |
javax.swing.JPanel |
getComponentPanel()
This method gets the component panel. |
java.awt.Container |
getDisplayPane()
|
javax.swing.JToolBar |
getMainToolBar()
This method returns the main toolbar. |
java.lang.String |
getOnlineDescription()
|
javax.swing.JTable |
getResultTable()
|
javax.swing.JComboBox |
getStopChoice()
This method returns the stop choice. |
int |
getStopFreq()
This method returns the stop frequency. |
int |
getTime()
This method gets the time parameter of the stochastic process. |
javax.swing.Timer |
getTimer()
This method returns the timer. |
javax.swing.JComboBox |
getUpdateChoice()
This method returns the update choice. |
void |
graphUpdate()
|
void |
init()
This method initializes the experiment, by setting up the basic simulation buttons (step, run, stop, reset), and the update and stop choices on the main toolbar. |
void |
initialize()
|
void |
itemStateChanged(java.awt.event.ItemEvent e)
This method handles the choice events, associated with the update and stop choices. |
void |
mouseClicked(java.awt.event.MouseEvent event)
Mouse events |
void |
mouseDragged(java.awt.event.MouseEvent event)
|
void |
mouseEntered(java.awt.event.MouseEvent event)
|
void |
mouseExited(java.awt.event.MouseEvent event)
|
void |
mouseMoved(java.awt.event.MouseEvent event)
Mouse motion events |
void |
mousePressed(java.awt.event.MouseEvent event)
|
void |
mouseReleased(java.awt.event.MouseEvent event)
|
void |
pasteData(java.awt.datatransfer.Clipboard c)
|
void |
playnote(boolean b)
This method plays note 1 if the boolean argument is true and note 0 otherwise. |
void |
playnote(int i)
This method plays one of the standard "telephone" notes 0.au through 9.au. |
void |
reset()
This method is the default reset method, that resets the process to its initial state. |
void |
run()
This method runs the experiment is repeatedly, and the update and stop counters incremented on each run. |
void |
setApplet(javax.swing.JApplet applet)
|
void |
setDecimalFormat(java.text.DecimalFormat d)
This methd sets the decimal format, so that the properties of the decimal format can then be changed. |
void |
setShowModelDistribution(boolean flag)
|
protected void |
setStopChoice(int index)
This method sets the stop-choice. |
void |
setStopChoiceTipText(java.lang.String str)
This method sets the stop-choice. |
void |
setStopFreq(int i)
This method sets the stop frequency. |
void |
setStopNow(boolean b)
This method defines the boolean variable that stops the process, when the simulation is in run mode. |
void |
stateChanged(javax.swing.event.ChangeEvent e)
JSlider events |
void |
step()
This method is the default step method, that runs the process one time unit. |
void |
stop()
This method stops the simulation when the simulation is in run mode.. |
void |
update()
This method is the default update method and defines how the display is updated. |
void |
windowActivated(java.awt.event.WindowEvent event)
|
void |
windowClosed(java.awt.event.WindowEvent event)
|
void |
windowClosing(java.awt.event.WindowEvent event)
|
void |
windowDeactivated(java.awt.event.WindowEvent event)
|
void |
windowDeiconified(java.awt.event.WindowEvent event)
|
void |
windowIconified(java.awt.event.WindowEvent event)
|
void |
windowOpened(java.awt.event.WindowEvent event)
Window events |
Methods inherited from class javax.swing.JApplet |
---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.applet.Applet |
---|
destroy, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface edu.ucla.stat.SOCR.core.Pluginable |
---|
getName |
Field Detail |
---|
public int time
public int updateCount
public int stopCount
public int updateFreq
public int stopFreq
public int toolIndex
public boolean stopNow
protected javax.swing.JPanel toolBars
protected javax.swing.JPanel componentPanel
public javax.swing.JComboBox stopChoice
public javax.swing.Timer timer
public static final java.awt.Color RED
public static final java.awt.Color GREEN
protected javax.swing.JApplet applet
protected boolean showModelDistribution
Constructor Detail |
---|
public Experiment()
Method Detail |
---|
public void init()
init
in class java.applet.Applet
public int getTime()
getTime
in interface IExperiment
public void pasteData(java.awt.datatransfer.Clipboard c)
pasteData
in interface IExperiment
public java.lang.String getAppletInfo()
getAppletInfo
in interface IExperiment
getAppletInfo
in class java.applet.Applet
public java.lang.String getOnlineDescription()
getOnlineDescription
in interface IExperiment
public void stop()
stop
in interface IExperiment
stop
in class java.applet.Applet
public void run()
update
method is called.
If the stop count equals the stop frequency, the simulation is stopped.
public void actionPerformed(java.awt.event.ActionEvent e)
step
method, which runs the
experiment one time, and then stops. The run button calls the run
method,
which runs the experiment repeatedly. The stop button calls the stop
method, which
stops the run mode and then calls the update
method if necessary.
The reset button callse the reset
method. The about button
shows a message dialog box with the text from getAppletInfo
method.
This method also handles the timer events.
actionPerformed
in interface java.awt.event.ActionListener
e
- the action eventpublic void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener
e
- the item eventpublic void doExperiment()
doExperiment
in interface IExperiment
public void step()
step
in interface IExperiment
public void reset()
reset
in interface IExperiment
public void update()
update
in interface IExperiment
public void graphUpdate()
graphUpdate
in interface IExperiment
public void setStopNow(boolean b)
setStopNow
in interface IExperiment
b
- the boolean variable that defines when the experiment stopspublic int getStopFreq()
getStopFreq
in interface IExperiment
public void setStopFreq(int i)
setStopFreq
in interface IExperiment
i
- the number of runs until the simulation stopspublic java.lang.String format(double x)
x
- the number to be formatted.
public void setDecimalFormat(java.text.DecimalFormat d)
public void addComponent(java.awt.Component c, int x, int y, int w, int h, int wx, int wy)
c
- the componentx
- the column number of the componenty
- the row number of the componentw
- the number of columns spanned by the componenth
- the number of rows panned by the componentwx
- the horizontal weight factor;wy
- the vertical weight factor;public void addComponent(java.awt.Component c, int x, int y, int w, int h, int f)
c
- the componentx
- the column number of the componenty
- the row number of the componentw
- the number of columns spanned by the componenth
- the number of rows panned by the componentf
- the fill parameter;public void addComponent(java.awt.Component c, int x, int y, int w, int h)
c
- the componentx
- the column number of the componenty
- the row number of the componentw
- the row span of the componenth
- the column span of the componentpublic void addToolBar(java.awt.Component c)
c
- the component to be addedpublic void clearToolBars()
public void addTool(java.awt.Component c)
c
- the component to be added to the toolbarpublic javax.swing.JToolBar getMainToolBar()
public javax.swing.JPanel getComponentPanel()
public javax.swing.JComboBox getUpdateChoice()
public javax.swing.JComboBox getStopChoice()
protected void setStopChoice(int index)
index
- is the index to choose from the stopChoice Listpublic void setStopChoiceTipText(java.lang.String str)
index
- is the index to choose from the stopChoice Listpublic javax.swing.Timer getTimer()
public void playnote(int i)
i
- the note indexpublic void playnote(boolean b)
b
- the boolean variablepublic void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseMoved(java.awt.event.MouseEvent event)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void windowOpened(java.awt.event.WindowEvent event)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent event)
windowClosing
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent event)
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent event)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent event)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent event)
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent event)
windowDeactivated
in interface java.awt.event.WindowListener
public void setApplet(javax.swing.JApplet applet)
setApplet
in interface Pluginable
public java.awt.Container getDisplayPane()
getDisplayPane
in interface Pluginable
public void initialize()
initialize
in interface IExperiment
public void setShowModelDistribution(boolean flag)
setShowModelDistribution
in interface IExperiment
public javax.swing.JTable getResultTable()
getResultTable
in interface IExperiment
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |