From 4072775c0981039d44b4538681a7e7cdcfa6409e Mon Sep 17 00:00:00 2001 From: Jordan Wages Date: Wed, 24 Jun 2026 13:10:29 -0500 Subject: [PATCH] Establishing XMLDoc conventions --- src/StandardLibrary/Initializer.cs | 46 +++++++++++++++++++++++++-- src/StandardLibrary/functions/Sign.cs | 10 ++++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/StandardLibrary/Initializer.cs b/src/StandardLibrary/Initializer.cs index bdb246a..02d0f7b 100644 --- a/src/StandardLibrary/Initializer.cs +++ b/src/StandardLibrary/Initializer.cs @@ -8,14 +8,33 @@ using CSMic.StandardLibrary.Functions.Random; namespace CSMic.StandardLibrary { + /// + /// Offers helper methods to initialize a with collections of + /// standard mathematical expressions and constants. + /// public static class Initializer { - public static void InitializeAll(InputInterpreter interpreter) + /// Initializes all standard library functions and constants. + /// Thrown when one or more required arguments are null. + /// The input interpreter. + /// + /// + /// + /// ### The interpreter to hydrate. + public static void InitializeAll(InputInterpreter inputInterpreter) { - InitializeAllFunctions(interpreter); - InitializeConstants(interpreter); + if (inputInterpreter == null) + { + throw new ArgumentNullException("inputInterpreter", "Cannot initialize a null InputInterpreter."); + } + + InitializeAllFunctions(inputInterpreter); + InitializeConstants(inputInterpreter); } + /// Initializes all standard library functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeAllFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -31,6 +50,9 @@ namespace CSMic.StandardLibrary InitializeRandomFunctions(inputInterpreter); } + /// Initializes the base standard library functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeBaseFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -44,6 +66,9 @@ namespace CSMic.StandardLibrary inputInterpreter.RegisterFunction(new Max()); } + /// Initializes the angle-related functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeAngleFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -56,6 +81,9 @@ namespace CSMic.StandardLibrary inputInterpreter.RegisterFunction(new WrapAngle()); } + /// Initializes the number theory functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeNumberTheoryFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -70,6 +98,9 @@ namespace CSMic.StandardLibrary inputInterpreter.RegisterFunction(new LeastCommonMultiple()); } + /// Initializes the rounding functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeRoundingFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -85,6 +116,9 @@ namespace CSMic.StandardLibrary inputInterpreter.RegisterFunction(new Clamp()); } + /// Initializes the trigonometry functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeTrigonometryFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -110,6 +144,9 @@ namespace CSMic.StandardLibrary inputInterpreter.RegisterFunction(new Atanh()); } + /// Initializes the psuedorandom generation and statistics functions. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeRandomFunctions(InputInterpreter inputInterpreter) { if (inputInterpreter == null) @@ -125,6 +162,9 @@ namespace CSMic.StandardLibrary inputInterpreter.RegisterFunction(new RandomNormalSpread()); } + /// Initializes the standard library constants. + /// Thrown when one or more required arguments are null. + /// The input interpreter. public static void InitializeConstants(InputInterpreter inputInterpreter) { if (inputInterpreter == null) diff --git a/src/StandardLibrary/functions/Sign.cs b/src/StandardLibrary/functions/Sign.cs index f75dace..4ad01d9 100644 --- a/src/StandardLibrary/functions/Sign.cs +++ b/src/StandardLibrary/functions/Sign.cs @@ -3,11 +3,16 @@ namespace CSMic.StandardLibrary.Functions { + /// A function that returns 1 if the expression is positive and -1 if it is negative. public class Sign : FunctionBase, ICodedFunction { + /// (Immutable) The return value representing "positive". private const decimal POSITIVE = 1; + /// (Immutable) The return value representing "negative". private const decimal NEGATIVE = -1; + /// Gets the name of the function. + /// sign. public string Name { get @@ -16,6 +21,8 @@ namespace CSMic.StandardLibrary.Functions } } + /// Gets the expected arguments. + /// The expected arguments. public override IEnumerable ExpectedArguments { get @@ -24,6 +31,9 @@ namespace CSMic.StandardLibrary.Functions } } + /// Executes the function with the given arguments. + /// A variable-length parameters list containing arguments. + /// A representing the result of the function execution. public FunctionValue Execute(params FunctionArgument[] args) { return base.Execute(args, (_args) =>