private void QueuePendingOperation()
        {
            Debug.Assert(IsFormulaBeingConstructed());
            Debug.Assert(pendingOp.HasValue);

            switch (pendingOp.Value)
            {
            case Operation.ADD:
                root = new Model.Add(root, new Model.Value(inputField.Value));
                break;

            case Operation.SUBSTRACT:
                root = new Model.Substract(root, new Model.Value(inputField.Value));
                break;

            case Operation.MULTIPLY:
                root = new Model.Multiply(root, new Model.Value(inputField.Value));
                break;

            case Operation.DIVIDE:
                root = new Model.Divide(root, new Model.Value(inputField.Value));
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Beispiel #2
0
 public Divide(Evaluable v1, Evaluable v2)
 {
     this.v1 = v1;
     this.v2 = v2;
 }
Beispiel #3
0
 public Multiply(Evaluable v1, Evaluable v2)
 {
     this.v1 = v1;
     this.v2 = v2;
 }
 private void ResetStateMachine()
 {
     root      = null;
     pendingOp = null;
 }
        private void QueueInitialValue()
        {
            Debug.Assert(!IsFormulaBeingConstructed());

            root = new Model.Value(inputField.Value);
        }