Class Parameters

java.lang.Object
edu.cmu.tetrad.util.Parameters
All Implemented Interfaces:
TetradSerializable, Serializable

public class Parameters extends Object implements TetradSerializable
Stores a list of named parameters with their values. Stores default values for known parameters. Returns a list of parameters with their values, for the parameters whose values have been retrieved, using the toString method.
Author:
josephramsey
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Parameters(Parameters parameters)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String name)
    Returns the object value of the given parameter, looking up its default in the ParamDescriptions map.
    get(String name, Object defaultValue)
    Returns the object value of the given parameter, using the given default.
    boolean
    Returns the boolean value of the given parameter, looking up its default in the ParamDescriptions map.
    boolean
    getBoolean(String name, boolean defaultValue)
    Returns the boolean value of the given parameter, using the given default.
    double
    Returns the double value of the given parameter, looking up its default in the ParamDescriptions map.
    double
    getDouble(String name, double defaultValue)
    Returns the object value of the given parameter, using the given default.
    int
    getInt(String name)
    Returns the integer value of the given parameter, looking up its default in the ParamDescriptions map.
    int
    getInt(String name, int defaultValue)
    Returns the integer value of the given parameter, looking up its default in the ParamDescriptions map.
    long
    Returns the long value of the given parameter, looking up its default in the ParamDescriptions map.
    long
    getLong(String name, long defaultValue)
    Returns the long value of the given parameter, looking up its default in the ParamDescriptions map.
    int
    Returns the number of values for the parameter.
     
    Returns the string value of the given parameter, looking up its default in the ParamDescriptions map.
    getString(String name, String defaultValue)
    Returns the string value of the given parameter, using the given default.
    Returns the values set for the given parameter.
    void
    putAll(Parameters parameters)
     
    static Parameters
     
    void
    set(String name, Object value)
    Sets the given parameter to the given value.
    void
    set(String name, Object... n)
    Sets the value(s) of the given parameter to a list of strings.
    void
    set(String name, String value)
    Sets the given parameter to the given value.
    void
    set(String name, String... s)
    Sets the value(s) of the given parameter to a list of values.
    Returns a list of the parameters whose values were actually used in the course of the simulation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Parameters

      public Parameters()
    • Parameters

      public Parameters(Parameters parameters)
  • Method Details

    • serializableInstance

      public static Parameters serializableInstance()
    • putAll

      public void putAll(Parameters parameters)
    • toString

      public String toString()
      Returns a list of the parameters whose values were actually used in the course of the simulation.
      Overrides:
      toString in class Object
      Returns:
      this list, in String form
    • getInt

      public int getInt(String name)
      Returns the integer value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name of the parameter.
      Returns:
      The integer value of this parameter.
    • getLong

      public long getLong(String name)
      Returns the long value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name of the parameter.
      Returns:
      The long value of this parameter.
    • getBoolean

      public boolean getBoolean(String name)
      Returns the boolean value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name of the parameter.
      Returns:
      The boolean value of this parameter.
    • getDouble

      public double getDouble(String name)
      Returns the double value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name or the parameter.
      Returns:
      The double value of this parameter.
    • getString

      public String getString(String name)
      Returns the string value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name or the parameter.
      Returns:
      The string value of this parameter.
    • get

      public Object get(String name)
      Returns the object value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name of the parameter.
      Returns:
      The object value of this parameter.
    • getInt

      public int getInt(String name, int defaultValue)
      Returns the integer value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name of the parameter.
      Returns:
      The integer value of this parameter.
    • getLong

      public long getLong(String name, long defaultValue)
      Returns the long value of the given parameter, looking up its default in the ParamDescriptions map.
      Parameters:
      name - The name of the parameter.
      Returns:
      The long value of this parameter.
    • getBoolean

      public boolean getBoolean(String name, boolean defaultValue)
      Returns the boolean value of the given parameter, using the given default.
      Parameters:
      name - The name of the parameter.
      Returns:
      The boolean value of this parameter.
    • getDouble

      public double getDouble(String name, double defaultValue)
      Returns the object value of the given parameter, using the given default.
      Parameters:
      name - The name of the parameter.
      Returns:
      The double value of this parameter.
    • getString

      public String getString(String name, String defaultValue)
      Returns the string value of the given parameter, using the given default.
      Parameters:
      name - The name of the parameter.
      Returns:
      The string value of this parameter.
    • get

      public Object get(String name, Object defaultValue)
      Returns the object value of the given parameter, using the given default.
      Parameters:
      name - The name of the parameter.
      Returns:
      The object value of this parameter.
    • getValues

      public Object[] getValues(String name)
      Returns the values set for the given parameter. Usually of length 1.
      Parameters:
      name - The name of the parameter.
      Returns:
      The array of values.
    • set

      public void set(String name, Object... n)
      Sets the value(s) of the given parameter to a list of strings.
      Parameters:
      name - The name of the parameter.
      n - A list of values for the parameter.
    • set

      public void set(String name, String... s)
      Sets the value(s) of the given parameter to a list of values.
      Parameters:
      name - The name of the parameter.
      s - A list of strings for the parameter.
    • getNumValues

      public int getNumValues(String name)
      Returns the number of values for the parameter.
      Parameters:
      name - The name of the parameter.
      Returns:
      The number of values set for that parameter.
    • set

      public void set(String name, Object value)
      Sets the given parameter to the given value.
      Parameters:
      name - The name of the parameter.
      value - The value of the parameter (a single value).
    • set

      public void set(String name, String value)
      Sets the given parameter to the given value.
      Parameters:
      name - The name of the parameter.
      value - The value of the parameter (a single value).
    • getParametersNames

      public Set<String> getParametersNames()