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 Summary
Fields Modifier and Type Field Description static booleanasteriskMultiplicationDenotes whether or not multiplication should be delimited by asterisks (as in2 * x) or not (as in2x)static booleancacheDerivativesDenotes whether or not the derivatives of functions should be cached when created.static FactorialTypedefaultFactorialDenotes the default implementation ofFactorialto be used.static intdefaultRangeSectionsThe amount of segments whichSolversplits a given range into.static doubledefaultSleepThe default amount to be slept on newlines inMiscTools.printWithSleep(java.lang.String).static intdefaultSolverIterationsThe amount of times thatSolverwill run unless the exit conditions are met beforehand.static SolverTypedefaultSolverTypeDenotes the default method used to solve equations.static booleandistributeExponentsDenotes whether exponents should be distributed over multiplication insimplify().static booleandistributeFunctionsDenotes whether products are distributed over addition insimplify().static booleandoCombinatoricsDenotes whether or not combinatorial operations should be parsed.static booleanenforceDomainAndRangeDenotes whether or not inverse simplifications conserve domain and rangestatic booleanenforceEscapedFunctionsDenotes whether or not expressions likesin(pi/2)must be escaped to\sin(\pi/2).static booleanenforceEscapedNamesDenotes whether or not the regex for valid variable, function, and constant names should enforce a LaTeX escape in multi-character names.static booleanenforceIntegerOperationsForces functions infunctions.unitary.integerto return integers when using approximations.static booleanenforcePatternMatchingNamesDenotes whether or not variable, function, and constant names should be checked against the valid name regexParsingTools.validNamesstatic doubleequalsMarginThe default margin to be used when checking if two doubles are equal.static booleanexecuteOnSimplifyDenotes whether aTransformationshould execute its action whensimplify()is called.static booleanexitSolverOnProximityDenotes whether methods intools.singlevariableshould exit if the result is within a certain proximity of the target.static doubleintegerMarginThe margin used inParsingTools.toInteger(double)when deciding when adoubleis close enough to an integer.static intmaxEscapeLengthThe maximum length that a LaTeX escape extends before expiring.static booleanprintStackTracesDenotes whether full stack traces of errors should be printed for debugging.static booleanreadPropertiesWhen this setting is enabled,SettingsusesparseConfig()to readcas.propertiesand those values are stored in this class.static booleanremoveEscapesDenotes whether or not escapes should be removed from variable, function, and constant names when printing.static booleansimplifyFunctionsOfConstantsDenotes whether functions of constants should be simplified.static booleansimplifyFunctionsOfSpecialConstantsDenotes whether or not special Constants get simplified into decimal under addition, multiplication, or exponentiation.static intsimpsonsSegmentsThe number of segments thatNumericalIntegration.simpsonsRule(GeneralFunction, double, double)uses when performing numerical integration.static StringsingleVariableDefaultThe variable to be used intools.singlevariablewhen none is specified.static booleantruncateNearIntegersDenotes whether or not constants close to integers are printed as integers (zero not included)static doublezeroMarginThe margin thatSolveruses to determine if a value is close enough to zero to be considered a root of a function. -
Method Summary
Modifier and Type Method Description static voidparseConfig()Parses the configuration filecas.propertiesand stores the read values inSettingsstatic voidparseSingleSetting(String key, String value)Parses string input to a single setting to be stored inSettings
-
Field Details
-
readProperties
public static boolean readPropertiesWhen this setting is enabled,SettingsusesparseConfig()to readcas.propertiesand those values are stored in this class. -
defaultSolverIterations
public static int defaultSolverIterationsThe amount of times thatSolverwill run unless the exit conditions are met beforehand. -
defaultRangeSections
public static int defaultRangeSectionsThe amount of segments whichSolversplits a given range into. -
simpsonsSegments
public static int simpsonsSegmentsThe number of segments thatNumericalIntegration.simpsonsRule(GeneralFunction, double, double)uses when performing numerical integration. **MUST BE EVEN** -
maxEscapeLength
public static int maxEscapeLengthThe 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 singleVariableDefaultThe variable to be used intools.singlevariablewhen none is specified. -
zeroMargin
public static double zeroMarginThe margin thatSolveruses to determine if a value is close enough to zero to be considered a root of a function. -
integerMargin
public static double integerMarginThe margin used inParsingTools.toInteger(double)when deciding when adoubleis close enough to an integer. -
equalsMargin
public static double equalsMarginThe default margin to be used when checking if two doubles are equal. -
defaultSleep
public static double defaultSleepThe default amount to be slept on newlines inMiscTools.printWithSleep(java.lang.String). -
enforceEscapedFunctions
public static boolean enforceEscapedFunctionsDenotes whether or not expressions likesin(pi/2)must be escaped to\sin(\pi/2). Enabling this is strongly recommended, and may reduce bugs. -
enforceEscapedNames
public static boolean enforceEscapedNamesDenotes 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 enforcePatternMatchingNamesDenotes whether or not variable, function, and constant names should be checked against the valid name regexParsingTools.validNames -
removeEscapes
public static boolean removeEscapesDenotes whether or not escapes should be removed from variable, function, and constant names when printing. -
simplifyFunctionsOfConstants
public static boolean simplifyFunctionsOfConstantsDenotes whether functions of constants should be simplified. Ex:\sin(\pi/2) -> 1 -
simplifyFunctionsOfSpecialConstants
public static boolean simplifyFunctionsOfSpecialConstantsDenotes whether or not special Constants get simplified into decimal under addition, multiplication, or exponentiation. -
distributeExponents
public static boolean distributeExponentsDenotes whether exponents should be distributed over multiplication insimplify(). Ex:(2x)^2 -> 4x^2 -
cacheDerivatives
public static boolean cacheDerivativesDenotes whether or not the derivatives of functions should be cached when created. -
enforceIntegerOperations
public static boolean enforceIntegerOperationsForces functions infunctions.unitary.integerto return integers when using approximations. -
exitSolverOnProximity
public static boolean exitSolverOnProximityDenotes whether methods intools.singlevariableshould exit if the result is within a certain proximity of the target. Improves performance at the cost of accuracy. -
executeOnSimplify
public static boolean executeOnSimplifyDenotes whether aTransformationshould execute its action whensimplify()is called. -
distributeFunctions
public static boolean distributeFunctionsDenotes whether products are distributed over addition insimplify(). Ex:x(y+z) -> (xy+xz) -
printStackTraces
public static boolean printStackTracesDenotes whether full stack traces of errors should be printed for debugging. -
enforceDomainAndRange
public static boolean enforceDomainAndRangeDenotes whether or not inverse simplifications conserve domain and range -
asteriskMultiplication
public static boolean asteriskMultiplicationDenotes whether or not multiplication should be delimited by asterisks (as in2 * x) or not (as in2x) -
truncateNearIntegers
public static boolean truncateNearIntegersDenotes whether or not constants close to integers are printed as integers (zero not included) -
doCombinatorics
public static boolean doCombinatoricsDenotes 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
Denotes the default method used to solve equations. -
defaultFactorial
Denotes the default implementation ofFactorialto be used.
-
-
Method Details
-
parseConfig
public static void parseConfig() throws IOExceptionParses the configuration filecas.propertiesand stores the read values inSettings- 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 inSettings- Parameters:
key- the name of the setting, such as defaultSolverIterations or defaultFactorialvalue- the value of the setting, such as10000orRECURSIVE
-