edu.ucla.stat.SOCR.applications.demo
Class PortfolioApplication

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.applications.Application
              extended by edu.ucla.stat.SOCR.applications.demo.PortfolioApplication
All Implemented Interfaces:
IExperiment, IValueSettable, Pluginable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, java.util.Observer

public class PortfolioApplication
extends Application
implements java.util.Observer, IExperiment

The triangle experiment is to break a stick at random and see if the pieces form a triangle. If so, is the triangle acute or obtuse?


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
MultiplePartsPanel.SOCRToolBar
 
Field Summary
protected  int CHART_SIZE_X
           
protected  int CHART_SIZE_Y
           
protected  ChartPanel chartPanel
           
protected  double[][] CORR
           
protected  double error_bound_x
           
protected  double max_x
           
protected  double min_x
           
protected  double mouse_x
           
protected  double mouse_y
           
protected  int numOptions
           
protected  double[] R
           
protected  double step_x
           
protected  java.util.LinkedList<double[]> stockOptions
           
protected  double[] tmp_x
           
 
Fields inherited from class edu.ucla.stat.SOCR.applications.Application
clipboard, numStocks
 
Fields inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
applet, fName, graphs, mainPane, recordTable, tables, toolbar, toolbar2, toolbars
 
Constructor Summary
PortfolioApplication()
          This method initializes the experiment, including the toolbar, triangle, scatterplot, random variable graph and table
 
Method Summary
 void chartMouseClicked(ChartMouseEvent arg0)
           
 void chartMouseMoved(ChartMouseEvent arg0)
           
protected  JFreeChart createEmptyChart(PieDataset dataset)
           
 void doExperiment()
          This method defines what the experiment actually does, and should be overridden
 java.lang.String getAppletInfo()
           
 java.awt.Container getDisplayPane()
           
 java.lang.String getOnlineDescription()
           
 javax.swing.JTable getResultTable()
           
 int getStopFreq()
          This method returns the stop frequency
 int getTime()
          This method gets the time parameter of the stochastic process.
 void graphUpdate()
           
 void initialize()
           
 void mouseClicked(java.awt.event.MouseEvent event)
           
 void reset()
          This method is the default reset method, that resets the process to its initial state.
 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 setupStockOptions()
           
 void setupStockOptionsRec(int id, double share)
           
 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.
 void update(java.util.Observable arg0, java.lang.Object arg1)
          This method is the default update method and defines how the display is updated.
 
Methods inherited from class edu.ucla.stat.SOCR.applications.Application
addTool2, emptyTool, emptyTool2, getInstance, getLocalAbout, getLocalHelp, getWikiAbout, getWikiHelp, init, loadSlider, pasteData, setApplet, setNumberStocks, setTangent, updateGraph
 
Methods inherited from class edu.ucla.stat.SOCR.core.MultiplePartsPanel
addGraph, addTable, addTool, addTool2, addToolbar, format, getMainPanel, getName, getRecordTable, getTextPanel, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, play, removeToolbar, setName
 
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.IExperiment
pasteData
 
Methods inherited from interface edu.ucla.stat.SOCR.core.Pluginable
getName, setApplet
 

Field Detail

CHART_SIZE_X

protected final int CHART_SIZE_X
See Also:
Constant Field Values

CHART_SIZE_Y

protected final int CHART_SIZE_Y
See Also:
Constant Field Values

chartPanel

protected ChartPanel chartPanel

R

protected double[] R

CORR

protected double[][] CORR

numOptions

protected int numOptions

step_x

protected double step_x

min_x

protected double min_x

max_x

protected double max_x

error_bound_x

protected double error_bound_x

mouse_x

protected double mouse_x

mouse_y

protected double mouse_y

tmp_x

protected double[] tmp_x

stockOptions

protected java.util.LinkedList<double[]> stockOptions
Constructor Detail

PortfolioApplication

public PortfolioApplication()
This method initializes the experiment, including the toolbar, triangle, scatterplot, random variable graph and table

Method Detail

createEmptyChart

protected JFreeChart createEmptyChart(PieDataset dataset)

getTime

public int getTime()
Description copied from interface: IExperiment
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
Overrides:
getTime in class Application

stop

public void stop()
This method stops the simulation thread

Specified by:
stop in interface IExperiment
Overrides:
stop in class Application

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
Overrides:
step in class Application

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
Overrides:
reset in class Application

update

public void update(java.util.Observable arg0,
                   java.lang.Object arg1)
This method is the default update method and defines how the display is updated. This method should be overridden.

Specified by:
update in interface java.util.Observer
Overrides:
update in class MultiplePartsPanel

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class MultiplePartsPanel

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
Overrides:
setStopNow in class Application

getStopFreq

public int getStopFreq()
This method returns the stop frequency

Specified by:
getStopFreq in interface IExperiment
Overrides:
getStopFreq in class Application

setStopFreq

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

Specified by:
setStopFreq in interface IExperiment
Overrides:
setStopFreq in class Application

getOnlineDescription

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

getAppletInfo

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

doExperiment

public void doExperiment()
Description copied from interface: IExperiment
This method defines what the experiment actually does, and should be overridden

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

getDisplayPane

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

update

public void update()
Description copied from interface: IExperiment
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
Overrides:
update in class Application

setupStockOptionsRec

public void setupStockOptionsRec(int id,
                                 double share)

setupStockOptions

public void setupStockOptions()

initialize

public void initialize()
Specified by:
initialize in interface IExperiment
Overrides:
initialize in class Application

chartMouseClicked

public void chartMouseClicked(ChartMouseEvent arg0)

chartMouseMoved

public void chartMouseMoved(ChartMouseEvent arg0)

getResultTable

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

graphUpdate

public void graphUpdate()
Specified by:
graphUpdate in interface IExperiment
Overrides:
graphUpdate in class Application

setShowModelDistribution

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