Class AbstractCalculation

java.lang.Object
org.opensourcephysics.controls.AbstractCalculation
All Implemented Interfaces:
Calculation

public abstract class AbstractCalculation extends Object implements Calculation
AbstractCalculation is a template for simple calculations. Implement the calculate method to create a calculation.
Version:
1.0
Author:
Wolfgang Christian
  • Field Details

  • Constructor Details

    • AbstractCalculation

      public AbstractCalculation()
  • Method Details

    • setControl

      public void setControl(Control control)
      Sets object that controls this calculation. The calculation should use this method to register its parameters with the control. This insures that the control displays the program's parameters when it appears onscreen.
      Specified by:
      setControl in interface Calculation
      Parameters:
      control -
    • getMainFrame

      public OSPFrame getMainFrame()
      Gets the main OSPFrame. The main frame will usually exit program when it is closed.
      Returns:
      OSPFrame
    • getMainFrameSize

      public int[] getMainFrameSize()
      Gets the Main Frame size.
    • addChildFrame

      public void addChildFrame(JFrame frame)
      Adds a child frame that depends on the main frame. Child frames are closed when this frame is closed.
      Parameters:
      frame - JFrame
    • getOSPApp

      public OSPApplication getOSPApp()
      Gets the main OSPFrame. The main frame will usually exit program when it is closed.
      Returns:
      OSPFrame
    • clearChildFrames

      public void clearChildFrames()
      Clears the child frames from the main frame.
    • getChildFrames

      public Collection<JFrame> getChildFrames()
      Gets a copy of the ChildFrames collection.
      Returns:
      Collection
    • calculate

      public abstract void calculate()
      Does the calculation.
      Specified by:
      calculate in interface Calculation
    • resetCalculation

      public void resetCalculation()
      Resets the calculation to a predefined state.
      Specified by:
      resetCalculation in interface Calculation
    • reset

      public void reset()
      Resets the program to its default state. Override this method to set the program's parameters.
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an XML.ObjectLoader to save and load data for this object.
      Returns:
      the object loader