/// <summary> /// Analyses the logic. /// </summary> /// <param name='theLogicString'> /// The logic string. /// </param> /// <param name='theOperand'> /// The operand. /// </param> private static bool?AnalyseLogicBlock(string theLogicString) { KGFLogicOperand aResultingOperand = new KGFLogicOperand(); string aTrimmedLogicString = theLogicString.Replace(" ", ""); string[] aSeparators = { itsStringAnd, itsStringOr /*, itsStringEqual, itsStringNotEqual*/ }; string[] anOperandNames = aTrimmedLogicString.Split(aSeparators, System.StringSplitOptions.None); foreach (string anOperandName in anOperandNames) { KGFLogicOperand anOperand = new KGFLogicOperand(); anOperand.SetName(anOperandName); aResultingOperand.AddOperand(anOperand); } for (int i = 0; i < anOperandNames.Length - 1; i++) { aTrimmedLogicString = aTrimmedLogicString.Remove(0, anOperandNames [i].Length); string anOperator = aTrimmedLogicString.Substring(0, 2); aResultingOperand.AddOperator(anOperator); aTrimmedLogicString = aTrimmedLogicString.Remove(0, 2); } return(aResultingOperand.Evaluate()); }
/// <summary> /// Analyses the logic. /// </summary> /// <param name='theLogicString'> /// The logic string. /// </param> /// <param name='theOperand'> /// The operand. /// </param> private static bool? AnalyseLogicBlock (string theLogicString) { KGFLogicOperand aResultingOperand = new KGFLogicOperand (); string aTrimmedLogicString = theLogicString.Replace (" ", ""); string[] aSeparators = { itsStringAnd, itsStringOr/*, itsStringEqual, itsStringNotEqual*/ }; string[] anOperandNames = aTrimmedLogicString.Split (aSeparators, System.StringSplitOptions.None); foreach (string anOperandName in anOperandNames) { KGFLogicOperand anOperand = new KGFLogicOperand (); anOperand.SetName (anOperandName); aResultingOperand.AddOperand (anOperand); } for (int i = 0; i< anOperandNames.Length-1; i++) { aTrimmedLogicString = aTrimmedLogicString.Remove (0, anOperandNames [i].Length); string anOperator = aTrimmedLogicString.Substring (0, 2); aResultingOperand.AddOperator (anOperator); aTrimmedLogicString = aTrimmedLogicString.Remove (0, 2); } return aResultingOperand.Evaluate (); }
public void AddOperand(KGFLogicOperand theOperand) { itsListOfOperands.Add(theOperand); }
public void AddOperand (KGFLogicOperand theOperand) { itsListOfOperands.Add (theOperand); }