/// <summary> /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcErrorExpression" /> class. /// </summary> /// <param name="value">The error value.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception> public CalcErrorExpression(CalcError value) : base(value) { if (value == null) { throw new ArgumentNullException(); } }
/// <summary> /// Returns a number corresponding to one of the error values /// or returns the #N/A error if no error exists. /// </summary> /// <param name="args"><para> /// The args contains 1 item: error_val. /// </para> /// <para> /// Error_val is the error value whose identifying number you want /// to find. Although error_val can be the actual error value, /// it will usually be a reference to a cell containing a formula /// that you want to test. /// </para></param> /// <returns> /// A <see cref="T:System.Int32" /> value that indicates the evaluate result. /// </returns> public override object Evaluate(object[] args) { base.CheckArgumentsLength(args); CalcError error = args[0] as CalcError; if (error != null) { switch (error.ErrorCode) { case 0: return((int)1); case 7: return((int)2); case 15: return((int)3); case 0x17: return((int)4); case 0x1d: return((int)5); case 0x24: return((int)6); case 0x2a: return((int)7); } } return(CalcErrors.NotAvailable); }
public static void BadAssert(string input, CalcError output, [CallerLineNumber] int line = 0) { CalcResult result = new Calc().Solve(input); if (result.Error != output) { Debug.WriteLine("Line " + line + ": " + input + " = " + output.ToString() + ", GOT " + result.Error.ToString()); } }
private bool IsErr(object obj) { if ((obj is CalcError) && (((CalcError)obj) != CalcErrors.NotAvailable)) { return(true); } if (!(obj is string)) { return(false); } CalcError error = CalcErrors.Parse((string)(obj as string), CultureInfo.InvariantCulture); return((error != null) && (error != CalcErrors.NotAvailable)); }
public CalcResult (CalcError error, string errorObject) { this.result = double.NaN; this.error = error; this.errorObject = errorObject; }
public CalcResult (CalcError error) { this.result = double.NaN; this.error = error; this.errorObject = ""; }
public CalcResult (double result) { this.result = result; this.error = CalcError.None; this.errorObject = ""; }
/// <summary> /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcExternalErrorExpression" /> class. /// </summary> /// <param name="source">The owner of error.</param> /// <param name="value">The error value.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception> public CalcExternalErrorExpression(ICalcSource source, CalcError value) : base(value) { this._source = source; }
public ParseResult(CalcError error, string errorObject) { this.output = ""; this.error = error; this.errorObject = errorObject; }
public ParseResult (CalcError error, string errorObject) { this.output = ""; this.error = error; this.errorObject = errorObject; }
public CalcResult(CalcError error, string errorObject) { this.result = double.NaN; this.error = error; this.errorObject = errorObject; }
public CalcResult(CalcError error) { this.result = double.NaN; this.error = error; this.errorObject = ""; }
public CalcResult(double result) { this.result = result; this.error = CalcError.None; this.errorObject = ""; }
/// <summary> /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcBangErrorExpression" /> class. /// </summary> /// <param name="value">The error value.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception> public CalcBangErrorExpression(CalcError value) : base(value) { }
public static void BadAssert (string input, CalcError output, string errorObject, [CallerLineNumber] int line = 0) { CalcResult result = new Calc ().Solve (input); if (result.Error != output) { Debug.WriteLine ("Line " + line + ": " + input + " = " + output.ToString () + ", GOT " + result.Error.ToString ()); } else if (result.ErrorObject != errorObject) { Debug.WriteLine ("Line " + line + ": " + input + " = " + output.ToString () + " and " + errorObject + ", GOT " + result.Error.ToString () + " and " + result.ErrorObject); } }
public ParseResult (string result) { this.output = result; this.error = CalcError.None; this.errorObject = ""; }
public ParseResult (CalcError error) { this.output = ""; this.error = error; this.errorObject = ""; }
public ParseResult(string result) { this.output = result; this.error = CalcError.None; this.errorObject = ""; }
public ParseResult(CalcError error) { this.output = ""; this.error = error; this.errorObject = ""; }
/// <summary> /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcSheetRangeErrorExpression" /> class. /// </summary> /// <param name="startSource">Starting owner of error.</param> /// <param name="endSource">Ending owner of error.</param> /// <param name="value">The error value.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception> public CalcSheetRangeErrorExpression(ICalcSource startSource, ICalcSource endSource, CalcError value) : base(value) { this._startSource = startSource; this._endSource = endSource; }