Class PiAWT

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
PiParallelAWT

public class PiAWT extends Panel
Graphical AWT elements for calculating pi using four different algorithms.
Version:
1.14.0
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • statusIndicator

      private PiAWT.StatusIndicator statusIndicator
    • precisionLabel

      private Label precisionLabel
    • precisionField

      private TextField precisionField
    • radixLabel

      private Label radixLabel
    • radixChoice

      private Choice radixChoice
    • methodLabel

      private Label methodLabel
    • methods

      private CheckboxGroup methods
    • chudnovsky

      private Checkbox chudnovsky
    • ramanujan

      private Checkbox ramanujan
    • gaussLegendre

      private Checkbox gaussLegendre
    • borwein

      private Checkbox borwein
    • implementationLabel

      private Label implementationLabel
    • implementationChoice

      private Choice implementationChoice
    • goButton

      private Button goButton
    • abortButton

      private Button abortButton
    • statusLabel

      private Label statusLabel
    • statusArea

      private TextArea statusArea
    • resultLabel

      private Label resultLabel
    • resultArea

      private TextArea resultArea
    • builderFactories

      private List<BuilderFactory> builderFactories
    • calculatorThread

      private Thread calculatorThread
  • Constructor Details

    • PiAWT

      public PiAWT(PiAWT.StatusIndicator statusIndicator)
      Construct a panel with graphical elements.
      Parameters:
      statusIndicator - Handler for showing error messages in the application.
  • Method Details

    • initGUI

      private void initGUI()
    • initThreads

      protected void initThreads(Container container, GridBagConstraints constraints)
      Initialize the "threads" section GUI elements. Elements should be added for the remainder of the width of the container.
      Parameters:
      container - The container where the elements are to be added.
      constraints - The constraints with which the elements are to be added to the container.
    • isInputValid

      protected boolean isInputValid()
      Validates the input fields.
      Returns:
      true if all input fields contain valid values, otherwise false.
    • showStatus

      protected void showStatus(String status)
      Show the specified error status.
      Parameters:
      status - The status.
    • getOperation

      protected Operation<Apfloat> getOperation(long precision, int radix) throws ApfloatRuntimeException
      Get the calculation operation to execute.
      Parameters:
      precision - The precision to be used.
      radix - The radix to be used.
      Returns:
      The calculation operation to execute.
      Throws:
      ApfloatRuntimeException
    • startThread

      private void startThread()
    • stopThread

      private void stopThread()
    • aborted

      private void aborted()
    • crashed

      private void crashed(Throwable cause)
    • end

      private void end()