public Combination(LogicEvaluator evaluator, string statement) : base(evaluator) { this.Items = new List <LogicItem>(); this.Raw = statement; this.BuildCombination(); }
public Reference(LogicEvaluator evaluator, string raw) : base(evaluator) { this.Raw = raw; this.Valid = true; if (!raw.StartsWith("'")) { if (StringHelper.IsNumber(raw)) { this.ReferenceType = Logic.ReferenceType.Number; this.NumericalValue = decimal.Parse(raw); this.Value = raw; } else { this.ReferenceType = Logic.ReferenceType.Parameter; this.ParamName = raw; string val; if (this.Evaluator.TryGetParamValue(raw, out val)) { if (StringHelper.IsNumber(val)) { NumericalValue = decimal.Parse(val); } } else { switch (this.Evaluator.FailToFindParam) { case FailToFindParamBehaviour.ThrowException: throw new ArgumentException(string.Format("Could not find parameter value in dictionary [{0}]", raw)); case FailToFindParamBehaviour.InvalidateClause: this.Valid = false; break; } } Value = val; } } else { this.ReferenceType = Logic.ReferenceType.Literal; var sub = this.Raw.Substring(1); this.Value = this.Raw.Substring(1, this.Raw.Substring(1).LastIndexOf("'")); if (StringHelper.IsNumber(this.Value)) { NumericalValue = decimal.Parse(this.Value); } } }
public Statement(LogicEvaluator evaluator, string statement) : base(evaluator) { this.Raw = statement; this.BuildStatement(); }
public LogicItem(LogicEvaluator evaluator) : base(evaluator) { }
public Clause(LogicEvaluator evaluator, string clause) : base(evaluator) { this.Raw = clause; this.BuildClause(); }
public LogicBase(LogicEvaluator evaluator) { this.Evaluator = evaluator; }