Class ParameterSettingsText

java.lang.Object
edu.cmu.tetrad.algcomparison.utils.ParameterSettingsText

public final class ParameterSettingsText extends Object
Renders the effective parameter settings of a configured algorithm as plain text suitable for copying into an email, a lab notebook, or a script - one name = value line per parameter, grouped into the same sections the parameter panel displays (algorithm, score, test, bootstrapping), with section titles taken from the annotations. Values are the effective ones: the value stored in the Parameters object if the user set one, otherwise the registered default. This is the reproducibility companion to the GUI parameter panel: what it prints is what the run will use.

Algorithms with hard-coded parameter groupings in the panel (e.g. RFCI-BSC) are rendered through the same generic sections here; the set of parameters is the same, only the grouping differs.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    The result of applying pasted settings text: the section titles encountered, the names of parameters whose values were applied, and the lines that were skipped (with reasons).
  • Method Summary

    Modifier and Type
    Method
    Description
    applySettingsText(String text, Parameters parameters)
    Parses settings text in the format produced by the render methods (" name = value" lines under title lines) and applies the parameter values to the given Parameters object.
    static String
    render(Algorithm algorithm, Parameters parameters, boolean sourceGraphSupplied)
    Renders the settings for the given configured algorithm.
    static String
    render(String title, Collection<String> params, Parameters parameters)
    Renders a single titled section of parameter settings as plain text, in the same format as the algorithm rendering: the title on its own line, then one " name = value" line per parameter, in the iteration order of the given collection.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • render

      public static String render(Algorithm algorithm, Parameters parameters, boolean sourceGraphSupplied)
      Renders the settings for the given configured algorithm.
      Parameters:
      algorithm - the configured algorithm (with score/test wrappers attached).
      parameters - the parameters object backing the panel.
      sourceGraphSupplied - whether a source graph is supplied (in which case bootstrapping is unavailable and noted as such).
      Returns:
      the settings as plain text.
    • render

      public static String render(String title, Collection<String> params, Parameters parameters)
      Renders a single titled section of parameter settings as plain text, in the same format as the algorithm rendering: the title on its own line, then one " name = value" line per parameter, in the iteration order of the given collection. Used by the simulation editor's "Settings as Text..." button.
      Parameters:
      title - the section title (e.g., the simulation and graph type).
      params - the parameter names, in display order.
      parameters - the parameter values.
      Returns:
      the rendered text.
    • applySettingsText

      public static ParameterSettingsText.ApplyResult applySettingsText(String text, Parameters parameters)
      Parses settings text in the format produced by the render methods (" name = value" lines under title lines) and applies the parameter values to the given Parameters object. Lines without an equals sign, or whose name part contains spaces, are treated as section titles and collected. Parameter values are parsed according to the type of the parameter's default value in the manual (Boolean, Integer, Long, Double, or String); parameters not documented in the manual, and values that fail to parse, are skipped and reported. This is deliberately conservative: nothing is applied for a line unless the parameter is known and the value parses cleanly.
      Parameters:
      text - the pasted settings text.
      parameters - the Parameters object to apply values to.
      Returns:
      the result, listing titles, applied parameters, and skipped lines.