using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace csmic.CodedFunctions { /// /// A coded implementation of the absolute value function. /// class CF_Abs : ICodedFunction { #region ICodedFunction Members /// /// Expects 1 argument. /// public int NumExpectedArguments { get { return 1; } } /// /// The name of the function. /// public string FunctionName { get { return "abs"; } } /// /// Executes a code block. /// /// The arguments used in the code block. /// The absolute value of the argument. public decimal Execute(params decimal[] args) { decimal output = 0; if (args.Length == this.NumExpectedArguments) { decimal input = args[0]; output = Math.Abs(input); } return output; } #endregion } }