/// <summary> /// Evaluates using the specified evaluator. /// </summary> /// <param name="evaluator">The evaluator.</param> /// <param name="baseRow">The base row.</param> /// <param name="baseColumn">The base column.</param> /// <param name="actualObj">The actual value object.</param> /// <returns><c>true</c> if the result is successful; otherwise, <c>false</c>.</returns> public override bool Evaluate(ICalcEvaluator evaluator, int baseRow, int baseColumn, IActualValue actualObj) { string text; if (this.forceValue2Text) { text = actualObj.GetText(); } else { object obj2 = actualObj.GetValue(); if ((obj2 is DateTime) || (obj2 is TimeSpan)) { return((((this.compareType != TextCompareType.BeginsWith) && (this.compareType != TextCompareType.EndsWith)) && (this.compareType != TextCompareType.Contains)) && (((this.compareType == TextCompareType.DoesNotBeginWith) || (this.compareType == TextCompareType.DoesNotEndWith)) || (this.compareType == TextCompareType.DoesNotContain))); } text = (obj2 == null) ? actualObj.GetText() : obj2.ToString(); } if (this.IgnoreBlank && string.IsNullOrEmpty(text)) { return(true); } string expected = base.GetExpectedString(evaluator, baseRow, baseColumn); switch (this.CompareType) { case TextCompareType.EqualsTo: return(this.IsEquals(expected, text)); case TextCompareType.NotEqualsTo: return(!this.IsEquals(expected, text)); case TextCompareType.BeginsWith: return(this.IsStartWith(expected, text)); case TextCompareType.DoesNotBeginWith: return(!this.IsStartWith(expected, text)); case TextCompareType.EndsWith: return(this.IsEndWith(expected, text)); case TextCompareType.DoesNotEndWith: return(!this.IsEndWith(expected, text)); case TextCompareType.Contains: return(this.IsContains(expected, text)); case TextCompareType.DoesNotContain: return(!this.IsContains(expected, text)); } return(false); }
/// <summary> /// Evaluates using the specified evaluator. /// </summary> /// <param name="evaluator">The evaluator.</param> /// <param name="baseRow">The base row.</param> /// <param name="baseColumn">The base column.</param> /// <param name="actualObj">The actual value object.</param> /// <returns><c>true</c> if the result is successful; otherwise, <c>false</c>.</returns> public override bool Evaluate(ICalcEvaluator evaluator, int baseRow, int baseColumn, IActualValue actualObj) { string text = actualObj.GetText(); if (string.IsNullOrEmpty(text)) { return(this.IgnoreBlank); } int num = (text == null) ? 0 : text.Length; int?nullable = base.GetExpectedInt(evaluator, baseRow, baseColumn); if (nullable.HasValue) { switch (this.compareType) { case GeneralCompareType.EqualsTo: return(num == nullable.Value); case GeneralCompareType.NotEqualsTo: return(num != nullable.Value); case GeneralCompareType.GreaterThan: return(num > nullable.Value); case GeneralCompareType.GreaterThanOrEqualsTo: return(num >= nullable.Value); case GeneralCompareType.LessThan: return(num < nullable.Value); case GeneralCompareType.LessThanOrEqualsTo: return(num <= nullable.Value); } } return(false); }