edu.ucla.stat.SOCR.core
Class Experiment

java.lang.Object
  extended by edu.ucla.stat.SOCR.core.SOCRValueSettable
      extended by edu.ucla.stat.SOCR.core.MultiplePartsPanel
          extended by edu.ucla.stat.SOCR.core.Experiment
All Implemented Interfaces:
IExperiment, IValueSettable, Pluginable, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.lang.Runnable, java.util.EventListener, java.util.Observer
Direct Known Subclasses:
BallotExperiment, BertrandExperiment, BetaCoinExperiment, BinomialCoinExperiment, BinomialTimelineExperiment, BirthdayExperiment, BivariateNormalExperiment, BivariateUniformExperiment, BuffonCoinExperiment, BuffonNeedleExperiment, CardExperiment, ChiSquareFitExperiment, ChuckALuckExperiment, CoinDieExperiment, CoinSampleExperiment, ConfidenceIntervalExperimentGeneral, ConfidenceIntervalExperimentSimple, CouponCollectorExperiment, CrapsExperiment, DiceExperiment, DiceSampleExperiment, DieCoinExperiment, EstimateExperiment, ExponentialExperiment, FiniteOrderStatisticExperiment, FireExperiment, GaltonBoardExperiment, GammaExperiment, GeneralBirthdayExperiment, MeanEstimateExperiment, MeanTestExperiment, MixtureEMExperiment, MixtureEMExperiment, MontyHallExperiment, NegativeBinomialExperiment, OrderStatisticExperiment, PointExperiment, Poisson2DExperiment, PoissonExperiment, PoissonSplitExperiment, PokerDiceExperiment, PokerExperiment, ProbabilityPlotExperiment, ProportionEstimateExperiment, ProportionTestExperiment, RandomVariableExperiment, RandomWalkExperiment, RedBlackExperiment, RouletteExperiment, SampleMeanExperiment, SignTestExperiment, SpinnerExperiment, TriangleExperiment, UrnExperiment, VarianceEstimateExperiment, VarianceTestExperiment, VoterExperiment

public class Experiment
extends MultiplePartsPanel
implements java.lang.Runnable, java.awt.event.ActionListener, java.awt.event.ItemListener, IExperiment

This class defines a basic, discrete time stochastic process that can be subclassed


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
MultiplePartsPanel.SOCRToolBar
 
Field Summary
protected  boolean showModelDistribution
           
 
Fields inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
applet, fName, graphs, mainPane, recordTable, tables, toolbar, toolbar2, toolbars
 
Constructor Summary
Experiment()
          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.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void doExperiment()
          This method defines what the experiment actually does, and should be overridden
 java.lang.String getAppletInfo()
           
 java.awt.Container getDisplayPane()
           
static IExperiment getInstance(java.lang.String classname)
           
 java.lang.String getName()
           
 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.JComboBox getUpdateChoice()
          This method returns the update choice.
 void graphUpdate()
           
 void initialize()
          used for some sublcass to initialize before be used
 void itemStateChanged(java.awt.event.ItemEvent event)
          This method handles the choice events, associated with the update and stop choices.
 void pasteData(java.awt.datatransfer.Clipboard c)
           
 void reset()
          This method is the default reset method, that resets the process to its initial state.
 void resetUpdateCount()
           
 void run()
          This method runs the simulation thread
 void setShowModelDistribution(boolean flag)
           
 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 step()
          This method is the default step method, that runs the process one time unit.
 void stop()
          This method stops the simulation thread
 void update()
          This method is the default update method and defines how the display is updated.
 
Methods inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
addGraph, addTable, addTool, addTool2, addToolbar, format, getMainPanel, getRecordTable, getTextPanel, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, play, removeToolbar, setApplet, setName, update
 
Methods inherited from class edu.ucla.stat.SOCR.core.SOCRValueSettable
createComponentSetter, createValueSetter, createValueSetter, createValueSetter, createValueSetter, getComponentSetter, getComponentSetters, getValueSetter, getValueSetters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.ucla.stat.SOCR.core.Pluginable
setApplet
 

Field Detail

showModelDistribution

protected boolean showModelDistribution
Constructor Detail

Experiment

public Experiment()
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. The record table that records the results of the experiment is initialized.

Method Detail

getInstance

public static IExperiment getInstance(java.lang.String classname)
                               throws java.lang.Exception
Throws:
java.lang.Exception

pasteData

public void pasteData(java.awt.datatransfer.Clipboard c)
Specified by:
pasteData in interface IExperiment

initialize

public void initialize()
used for some sublcass to initialize before be used

Specified by:
initialize in interface IExperiment

getTime

public int getTime()
This method gets the time parameter of the stochastic process. If the process is to replicate a basic random experiment, then the time parameter is the number of runs.

Specified by:
getTime in interface IExperiment

stop

public void stop()
This method stops the simulation thread

Specified by:
stop in interface IExperiment

run

public void run()
This method runs the simulation thread

Specified by:
run in interface java.lang.Runnable

getName

public java.lang.String getName()
Specified by:
getName in interface Pluginable
Overrides:
getName in class MultiplePartsPanel
Returns:
Returns the fName.

getAppletInfo

public java.lang.String getAppletInfo()
Specified by:
getAppletInfo in interface IExperiment

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
This method handles the choice events, associated with the update and stop choices.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

doExperiment

public void doExperiment()
This method defines what the experiment actually does, and should be overridden

Specified by:
doExperiment in interface IExperiment

step

public void step()
This method is the default step method, that runs the process one time unit. This method can be overridden to add sound or other elements

Specified by:
step in interface IExperiment

reset

public void reset()
This method is the default reset method, that resets the process to its initial state. This method should be overridden.

Specified by:
reset in interface IExperiment

update

public void update()
This method is the default update method and defines how the display is updated. This method should be overridden.

Specified by:
update in interface IExperiment

resetUpdateCount

public void resetUpdateCount()

graphUpdate

public void graphUpdate()
Specified by:
graphUpdate in interface IExperiment

setStopNow

public void setStopNow(boolean b)
This method defines the boolean variable that stops the process, when the simulation is in run mode

Specified by:
setStopNow in interface IExperiment

getStopFreq

public int getStopFreq()
This method returns the stop frequency

Specified by:
getStopFreq in interface IExperiment

setStopFreq

public void setStopFreq(int i)
This method sets the stop frequency

Specified by:
setStopFreq in interface IExperiment

getUpdateChoice

public javax.swing.JComboBox getUpdateChoice()
This method returns the update choice.


getStopChoice

public javax.swing.JComboBox getStopChoice()
This method returns the stop choice.


getOnlineDescription

public java.lang.String getOnlineDescription()
Specified by:
getOnlineDescription in interface IExperiment

getDisplayPane

public java.awt.Container getDisplayPane()
Specified by:
getDisplayPane in interface Pluginable

setShowModelDistribution

public void setShowModelDistribution(boolean flag)
Specified by:
setShowModelDistribution in interface IExperiment

getResultTable

public javax.swing.JTable getResultTable()
Specified by:
getResultTable in interface IExperiment