edu.ucla.stat.SOCR.experiments
Class VoterExperiment

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
              extended by edu.ucla.stat.SOCR.experiments.VoterExperiment
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

public class VoterExperiment
extends Experiment

This class models the voter experiment. Each member of a rectangular lattice of voters can, at any time, be in one of a finite number of states, represented by colors. At each time, a voter is chosen at random and then a neighbor of the voter is chosen with various probabilities. The state of the chosen voter is then changed to the state of the chosen neighbor.


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
MultiplePartsPanel.SOCRToolBar
 
Field Summary
 
Fields inherited from class edu.ucla.stat.SOCR.core.Experiment
showModelDistribution
 
Fields inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
applet, fName, graphs, mainPane, recordTable, tables, toolbar, toolbar2, toolbars
 
Constructor Summary
VoterExperiment()
          This method initializes the experiment, including the set of voters, the toolbar with choices and labels.
 
Method Summary
 void doExperiment()
          This method defines the experiment.
 void itemStateChanged(java.awt.event.ItemEvent event)
          This method handles the events associated with the stop choice and the voter choice.
 void mouseClicked(java.awt.event.MouseEvent event)
          This method handles the mouse events that correspond to clicking on a voter.
 void mouseMoved(java.awt.event.MouseEvent event)
          This method handles the mouse events that correspond moving the mouse over the voters.
 void reset()
          This method resets the experiment.
 void update()
          This method updates the experiment, including the voters and the record table.
 
Methods inherited from class edu.ucla.stat.SOCR.core.Experiment
actionPerformed, getAppletInfo, getDisplayPane, getInstance, getName, getOnlineDescription, getResultTable, getStopChoice, getStopFreq, getTime, getUpdateChoice, graphUpdate, initialize, pasteData, resetUpdateCount, run, setShowModelDistribution, setStopFreq, setStopNow, step, stop
 
Methods inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
addGraph, addTable, addTool, addTool2, addToolbar, format, getMainPanel, getRecordTable, getTextPanel, mouseDragged, mouseEntered, mouseExited, 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
 

Constructor Detail

VoterExperiment

public VoterExperiment()
This method initializes the experiment, including the set of voters, the toolbar with choices and labels.

Method Detail

doExperiment

public void doExperiment()
This method defines the experiment.

Specified by:
doExperiment in interface IExperiment
Overrides:
doExperiment in class Experiment

reset

public void reset()
This method resets the experiment.

Specified by:
reset in interface IExperiment
Overrides:
reset in class Experiment

update

public void update()
This method updates the experiment, including the voters and the record table.

Specified by:
update in interface IExperiment
Overrides:
update in class Experiment

itemStateChanged

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

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Overrides:
itemStateChanged in class Experiment

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
This method handles the mouse events that correspond moving the mouse over the voters.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class MultiplePartsPanel

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
This method handles the mouse events that correspond to clicking on a voter.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class MultiplePartsPanel