Package config

Class Settings

Object
Settings

public class Settings
extends Object
The Settings class stores global settings as static variables. These settings are read from cas.properties by parseConfig() on launch, and can be modified dynamically during runtime. Settings that are modified during runtime do NOT get written into the properties file. To save a settings profile, write it into cas.properties so it is read on launch. The class also contains tools for parsing settings from files and user input, then storing those settings for use by package methods.
  • Field Details

    • readProperties

      public static boolean readProperties
      When this setting is enabled, Settings uses parseConfig() to read cas.properties and those values are stored in this class.
    • defaultSolverIterations

      public static int defaultSolverIterations
      The amount of times that Solver will run unless the exit conditions are met beforehand.
    • defaultRangeSections

      public static int defaultRangeSections
      The amount of segments which Solver splits a given range into.
    • simpsonsSegments

      public static int simpsonsSegments
      The number of segments that NumericalIntegration.simpsonsRule(GeneralFunction, double, double) uses when performing numerical integration. **MUST BE EVEN**
    • maxEscapeLength

      public static int maxEscapeLength
      The maximum length that a LaTeX escape extends before expiring. This setting can only be changed through the config; modifying it during runtime will not do anything.
    • singleVariableDefault

      public static String singleVariableDefault
      The variable to be used in tools.singlevariable when none is specified.
    • zeroMargin

      public static double zeroMargin
      The margin that Solver uses to determine if a value is close enough to zero to be considered a root of a function.
    • integerMargin

      public static double integerMargin
      The margin used in ParsingTools.toInteger(double) when deciding when a double is close enough to an integer.
    • equalsMargin

      public static double equalsMargin
      The default margin to be used when checking if two doubles are equal.
    • defaultSleep

      public static double defaultSleep
      The default amount to be slept on newlines in MiscTools.printWithSleep(java.lang.String).
    • enforceEscapedFunctions

      public static boolean enforceEscapedFunctions
      Denotes whether or not expressions like sin(pi/2) must be escaped to \sin(\pi/2). Enabling this is strongly recommended, and may reduce bugs.
    • enforceEscapedNames

      public static boolean enforceEscapedNames
      Denotes whether or not the regex for valid variable, function, and constant names should enforce a LaTeX escape in multi-character names. Enabling this may improve error handling.
    • enforcePatternMatchingNames

      public static boolean enforcePatternMatchingNames
      Denotes whether or not variable, function, and constant names should be checked against the valid name regex ParsingTools.validNames
    • removeEscapes

      public static boolean removeEscapes
      Denotes whether or not escapes should be removed from variable, function, and constant names when printing.
    • simplifyFunctionsOfConstants

      public static boolean simplifyFunctionsOfConstants
      Denotes whether functions of constants should be simplified. Ex: \sin(\pi/2) -> 1
    • simplifyFunctionsOfSpecialConstants

      public static boolean simplifyFunctionsOfSpecialConstants
      Denotes whether or not special Constants get simplified into decimal under addition, multiplication, or exponentiation.
    • distributeExponents

      public static boolean distributeExponents
      Denotes whether exponents should be distributed over multiplication in simplify(). Ex: (2x)^2 -> 4x^2
    • cacheDerivatives

      public static boolean cacheDerivatives
      Denotes whether or not the derivatives of functions should be cached when created.
    • enforceIntegerOperations

      public static boolean enforceIntegerOperations
      Forces functions in functions.unitary.integer to return integers when using approximations.
    • exitSolverOnProximity

      public static boolean exitSolverOnProximity
      Denotes whether methods in tools.singlevariable should exit if the result is within a certain proximity of the target. Improves performance at the cost of accuracy.
    • executeOnSimplify

      public static boolean executeOnSimplify
      Denotes whether a Transformation should execute its action when simplify() is called.
    • distributeFunctions

      public static boolean distributeFunctions
      Denotes whether products are distributed over addition in simplify(). Ex: x(y+z) -> (xy+xz)
    • printStackTraces

      public static boolean printStackTraces
      Denotes whether full stack traces of errors should be printed for debugging.
    • enforceDomainAndRange

      public static boolean enforceDomainAndRange
      Denotes whether or not inverse simplifications conserve domain and range
    • asteriskMultiplication

      public static boolean asteriskMultiplication
      Denotes whether or not multiplication should be delimited by asterisks (as in 2 * x) or not (as in 2x)
    • truncateNearIntegers

      public static boolean truncateNearIntegers
      Denotes whether or not constants close to integers are printed as integers (zero not included)
    • doCombinatorics

      public static boolean doCombinatorics
      Denotes whether or not combinatorial operations should be parsed. This setting can only be changed through the config; modifying it during runtime will not do anything.
    • defaultSolverType

      public static SolverType defaultSolverType
      Denotes the default method used to solve equations.
    • defaultFactorial

      public static FactorialType defaultFactorial
      Denotes the default implementation of Factorial to be used.
  • Method Details

    • parseConfig

      public static void parseConfig() throws IOException
      Parses the configuration file cas.properties and stores the read values in Settings
      Throws:
      IOException - if the file cannot be found
    • parseSingleSetting

      public static void parseSingleSetting​(String key, String value)
      Parses string input to a single setting to be stored in Settings
      Parameters:
      key - the name of the setting, such as defaultSolverIterations or defaultFactorial
      value - the value of the setting, such as 10000 or RECURSIVE