static void Main(string[] args) { var f = new Charactor("f", Charactor.Types.Function, 3); var x = new Charactor("x", Charactor.Types.Value); var g = new Charactor("g", Charactor.Types.Function, 2); var y = new Charactor("y", Charactor.Types.Value); var h = new Charactor("h", Charactor.Types.Function, 1); var z = new Charactor("z", Charactor.Types.Value); var w = new Charactor("w", Charactor.Types.Quantifier); var s = new Charactor[7]; s[0] = f; s[1] = x; s[2] = g; s[3] = y; s[4] = h; s[5] = z; s[6] = w; var str = new CharSequence(s, null); Console.WriteLine(FormulaValidator.Validate(str)); }
public TsController( TableauSolutionService tableauSolutionService, EventService eventService, FormulaValidator formulaValidator) { EventService = eventService; TableauSolutionService = tableauSolutionService; FormulaValidator = formulaValidator; }
static void Main(string[] args) { var testData = new string[] { "(x + y) - ((z * y) + x)", "{(1 / 2) + (y / z)} - ([g + z]) - (x + y)", "[x + y] - (5 * x)", "(x + 3]", "{(y + z)]", "(x + y) + [g(5])]" }; var formulaValidator = new FormulaValidator(); foreach (var equation in testData) { Console.WriteLine( string.Format("{0} {1}", equation, formulaValidator.IsBalanced(equation)) ); } Console.ReadKey(); }