Class PortfolioEALCalculatorController

  extended by org.opensha.sra.gui.portfolioeal.PortfolioEALCalculatorController
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.lang.Runnable, java.util.EventListener, CalculationExceptionHandler

public class PortfolioEALCalculatorController
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.lang.Runnable, CalculationExceptionHandler

The controller for the Portfolio EAL calculator. This class is used to define the underlying functionality of the calculator.

Jeremy Leakakos
See Also:

Field Summary
static java.lang.String APP_NAME
static java.lang.String APP_SHORT_NAME
Constructor Summary
          The default constructor.
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Listen for the JButtons and the JComboBox.
 void calculationException(java.lang.String errorMessage)
          Exceptions occur during a calculation; this method gets the program back to its start state
 double computeEAL()
          This computes the EAL for a portfolio.
static java.util.HashMap<java.lang.String,Vulnerability> getVulnerabilities()
static java.util.HashMap<java.lang.String,Vulnerability> getVulnerabilities( file)
 void itemStateChanged(java.awt.event.ItemEvent event)
          ItemListener for the JCheckBox
static void main(java.lang.String[] args)
          The main method which drives the whole program.
 void run()
          This method is used when new thread is started on an object of this class.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final java.lang.String APP_NAME
See Also:
Constant Field Values


public static final java.lang.String APP_SHORT_NAME
See Also:
Constant Field Values
Constructor Detail


public PortfolioEALCalculatorController()
The default constructor. The main class of the program, which start the program, It creates and displays the view.

Method Detail


public static java.util.HashMap<java.lang.String,Vulnerability> getVulnerabilities()


public static java.util.HashMap<java.lang.String,Vulnerability> getVulnerabilities( file)


public static void main(java.lang.String[] args)
The main method which drives the whole program.

args - The command line arguments - These should be null.


public double computeEAL()
This computes the EAL for a portfolio.


public void actionPerformed(java.awt.event.ActionEvent event)
Listen for the JButtons and the JComboBox. "Compute" starts up a new thread that calls computeEAL(), which computes the EAL for a portfolio.>
"Clear Results" goes to clearResults(), which clears the I/O text area.
"Open Portfolio" opens up a new dialog that allows you to open a portfolio file.
"Cancel" stops the thread running the calculations and resets the buttons. JComboBox: "comboBoxSelection" Calls a method in view based on the selection

Specified by:
actionPerformed in interface java.awt.event.ActionListener
event - The ActionEvent fired when the buttons/combo box are selected.


public void itemStateChanged(java.awt.event.ItemEvent event)
ItemListener for the JCheckBox

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
event - The ItemEvent The event fired whent the check box is selected.


public void run()
This method is used when new thread is started on an object of this class. It starts the computation for the EAL, and then changes the buttons back to their default state. It also prints the calculation information to the I/O pane.

Specified by:
run in interface java.lang.Runnable


public void calculationException(java.lang.String errorMessage)
Exceptions occur during a calculation; this method gets the program back to its start state

Specified by:
calculationException in interface CalculationExceptionHandler
errorMessage - The string representation of the exception's error message.