public DoubleDivisionOperator(OperatorsPriority priority) : base(priority) { }
public DoubleMultiplicationOperator(OperatorsPriority priority) : base(priority) { }
public DoubleSubstractOperator(OperatorsPriority priority) : base(priority) { }
public DoubleAdditionOperator(OperatorsPriority priority) : base(priority) { }
public DoubleAbstractOperation(OperatorsPriority priority) => Priority = priority;
private Geometry ProcessEquation(string equation) { string equ = equation; equ = EndWithDelim(equ); Stack <Geometry> oprn = new Stack <Geometry>(); Stack <Operators> oprt = new Stack <Operators>(); oprt.Push(Operators.Delim); int pointer = 0; while (pointer < equ.Count()) { Operators curOprt; if (_dictNormalOperators.TryGetValue(equ[pointer], out curOprt)) { int curIndex = _oprtOperatorsPriorityIndexer.IndexOf(curOprt); int stackIndex = _oprtOperatorsPriorityIndexer.IndexOf(oprt.Peek()); OperatorsPriority op = _oprtOperatorsPriority[stackIndex, curIndex]; switch (op) { case OperatorsPriority.Bigger: if (oprn.Count < 2) { throw gVennDiagramException.InvalidEquation; } Console.WriteLine(curOprt); Geometry operand2 = oprn.Pop(); Geometry operand1 = oprn.Pop(); Geometry result = Operate(operand1, operand2, oprt.Pop()); oprn.Push(result); break; case OperatorsPriority.Smaller: oprt.Push(curOprt); pointer++; break; case OperatorsPriority.Equal: oprt.Pop(); pointer++; break; case OperatorsPriority.Invalid: throw gVennDiagramException.InvalidEquation; } } else if (_dictSpecialOperators.TryGetValue(equ[pointer], out curOprt)) { if (curOprt == Operators.Not) { Geometry operand = oprn.Pop(); Geometry result = Operate(operand, Operators.Not); oprn.Push(result); pointer++; } } else { oprn.Push(_dictOperandVisual[equ[pointer]]); pointer++; } } return(oprn.Pop()); }