public DataPair ApplyRule(DataPair input) { if (input.Type.IsNumericType()) { if (RuleHelper.IsValid(Regex, Convert.ToDouble(input.Data))) { var output = new DataPair { Data = SubstitutionNumber.ToString(), Type = typeof(double), IsTransformed = true, TransformationLog = $"{input.TransformationLog}Numbersub (matched { Regex }). {input.Data} => { SubstitutionNumber.ToString()}\n" }; return(output); } } return(input); }
public DataPair ApplyRule(DataPair input) { if (input.Type.IsNumericType()) { if (RuleHelper.IsValid(Regex, Convert.ToDouble(input.Data))) { var output = new DataPair { Data = input.Data.Replace(SubstitutionDigit.ToString(), Substitute.ToString()), Type = typeof(double), IsTransformed = true }; output.TransformationLog = $"{input.TransformationLog}Digitsub (matched { Regex }). {input.Data} => { output.Data.ToString()}\n"; return(output); } } return(input); }
public DataPair ApplyRule(DataPair input) { if (input.Type.IsNumericType()) { if (RuleHelper.IsValid(Regex, Convert.ToDouble(input.Data))) { string explicitFunction = Function.Replace("$x", input.Data); string evaluatedFunction = RuleHelper.EvaluateExpression(explicitFunction); double newValue = RuleHelper.EvaluateDouble(evaluatedFunction); var output = new DataPair { Data = newValue.ToString(), Type = typeof(double), IsTransformed = true, TransformationLog = $"{input.TransformationLog}Numbercalculation (matched { Regex }). {input.Data} => { newValue.ToString()}\n" }; return(output); } } return(input); }