Class ParamEditor

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible
Direct Known Subclasses:
InitialValueEditor

public class ParamEditor extends FunctionEditor
A FunctionEditor for Parameters.
Author:
Douglas Brown
See Also:
  • Field Details

    • paramValues

      protected double[] paramValues
    • paramDescriptions

      protected String[] paramDescriptions
    • syncedCheckbox

      protected JCheckBox syncedCheckbox
    • syncing

      protected boolean syncing
  • Constructor Details

    • ParamEditor

      public ParamEditor()
      Default constructor
    • ParamEditor

      public ParamEditor(DatasetManager input)
      Constructor using a DatasetManager to define initial parameters
      Parameters:
      input - the DatasetManager
  • Method Details

    • createGUI

      protected void createGUI()
      Description copied from class: FunctionEditor
      Creates the GUI.
      Overrides:
      createGUI in class FunctionEditor
    • refreshGUI

      public void refreshGUI()
      Description copied from class: FunctionEditor
      Refreshes the GUI.
      Overrides:
      refreshGUI in class FunctionEditor
    • enableMenuButtons

      protected void enableMenuButtons()
      Description copied from class: FunctionEditor
      Refreshes button states.
      Overrides:
      enableMenuButtons in class FunctionEditor
    • doSyncAction

      protected void doSyncAction()
      Sets the synced property of a Parameter.
      Parameters:
      synced - boolean
      param - the Parameter
    • getParameters

      public Parameter[] getParameters()
      Gets an array containing copies of the current parameters.
      Returns:
      an array of Parameters
    • setParameters

      public void setParameters(Parameter[] params)
      Replaces the current parameters with new ones.
      Parameters:
      params - an array of Parameters
    • setFunctionEditors

      public void setFunctionEditors(FunctionEditor[] editors)
      Sets the function editors that use these parameters.
      Parameters:
      editors - an array of FunctionEditors
    • getValues

      public double[] getValues()
      Gets the current parameter values.
      Returns:
      an array of values
    • getDescriptions

      public String[] getDescriptions()
      Gets the current parameter descriptions.
      Returns:
      an array of descriptions
    • getName

      public String getName(FunctionEditor.FObject obj)
      Returns the name of the object.
      Specified by:
      getName in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      the name
    • getExpression

      public String getExpression(FunctionEditor.FObject obj)
      Returns the expression of the object.
      Specified by:
      getExpression in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      the expression
    • getDescription

      public String getDescription(FunctionEditor.FObject obj)
      Returns the description of the object.
      Specified by:
      getDescription in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      the description
    • setDescription

      public void setDescription(FunctionEditor.FObject obj, String desc)
      Sets the description of an object.
      Overrides:
      setDescription in class FunctionEditor
      Parameters:
      obj - the object
      desc - the description
    • setDescription

      public void setDescription(String name, String description)
      Sets the description of the named parameter, if any.
      Parameters:
      name - the name
      description - the description
    • setSyncing

      public void setSyncing(boolean sync)
      Turns on syncing, used by ModelBuilder to sync Parameters
      Parameters:
      obj - the object
    • getTooltip

      public String getTooltip(FunctionEditor.FObject obj)
      Returns a tooltip for the object.
      Specified by:
      getTooltip in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      the tooltip
    • isNameEditable

      public boolean isNameEditable(FunctionEditor.FObject obj)
      Determines if an object's name is editable.
      Overrides:
      isNameEditable in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      true if the name is editable
    • isExpressionEditable

      public boolean isExpressionEditable(FunctionEditor.FObject obj)
      Determines if an object's expression is editable.
      Overrides:
      isExpressionEditable in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      true if the expression is editable
    • evaluateObject

      protected void evaluateObject(FunctionEditor.FObject obj)
      Evaluates an object.
    • evaluateDependents

      public ArrayList<Parameter> evaluateDependents(Parameter seed)
      Evaluates parameters that depend on the named parameter.
      Parameters:
      seed - the independent parameter
      Returns:
      a list of evaluated dependent parameters
    • evaluateAll

      public void evaluateAll()
      Evaluates all current objects.
      Specified by:
      evaluateAll in class FunctionEditor
    • isDisallowedName

      protected boolean isDisallowedName(FunctionEditor.FObject obj, String name)
      Returns true if a name is already in use.
      Overrides:
      isDisallowedName in class FunctionEditor
      Parameters:
      obj - the object (may be null)
      name - the proposed name for the object
      Returns:
      true if duplicate
    • pasteAction

      protected void pasteAction()
      Pastes the clipboard contents.
      Overrides:
      pasteAction in class FunctionEditor
    • isInvalidExpression

      protected boolean isInvalidExpression(FunctionEditor.FObject obj)
      Returns true if the object expression is invalid.
      Specified by:
      isInvalidExpression in class FunctionEditor
    • createObject

      protected FunctionEditor.FObject createObject(String name, String expression, FunctionEditor.FObject obj)
      Creates an object with specified name and expression. This always returns a new Parameter but copies the editable properties.
      Specified by:
      createObject in class FunctionEditor
      Parameters:
      name - the name
      expression - the expression
      obj - ignored
      Returns:
      the object
    • setTitles

      protected void setTitles()
      Specified by:
      setTitles in class FunctionEditor
    • loadParametersFromData

      public void loadParametersFromData()
      Loads parameters from the current datasetManager.
    • refreshParametersFromFunction

      protected void refreshParametersFromFunction(UserFunction f)
      Refreshes the parameters associated with a user function.
    • getDefaultName

      protected String getDefaultName()
      Returns the default name for newly created objects.
      Overrides:
      getDefaultName in class FunctionEditor
    • isImportant

      protected boolean isImportant(FunctionEditor.FObject obj)
      Description copied from class: FunctionEditor
      Determines if an object is important.
      Specified by:
      isImportant in class FunctionEditor
      Parameters:
      obj - the object
      Returns:
      true if important
    • setReferences

      protected void setReferences(FunctionEditor.FObject obj, BitSet directReferences)
      Description copied from class: FunctionEditor
      Subclasses implement to set objects referenced in an object's expression.
      Specified by:
      setReferences in class FunctionEditor