Exemplo n.º 1
0
        public void Clear()
        {
            total = 0;
            opperand1=0;
            opperand2=0;
            currentState = StartState.Singleton;
            //_pendingOp = _noOp;

            //        System.out.println("Clear All!");
        }
Exemplo n.º 2
0
 public Complex enterRectOperand(String input)
 {
     String [] parts = input.Trim ().Split ();
     if (parts.Length != 2) {
         currentState = ErrorState.Singleton;
         return null;
     } else {
         Complex c = new Complex (Double.Parse (parts [0]), Double.Parse (parts [1]));
         currentState.addOpperand (this, c);
         return c;
     }
 }
Exemplo n.º 3
0
 public void enterOperand(String input)
 {
     String [] parts = input.Trim ().Split ();
     if (parts.Length != 2) {
         currentState = ErrorState.Singleton;
         //throw new Exception("Could not parse this input");
     } else {
         Complex c = new Complex (Double.Parse (parts [0]), Double.Parse (parts [1]));
         currentState.addOpperand (this, c);
     }
 }
Exemplo n.º 4
0
 public Complex enterPolarOperand(string input)
 {
     String [] parts = input.Trim ().Split ();
     if (parts.Length != 2) {
         currentState = ErrorState.Singleton;
         return null;
     } else {
         //need to convert these to rectangle or add a new constrctor
         //that takes polar as input
         Complex c = new Complex (0, Double.Parse (parts [0]), Double.Parse (parts [1]));
         currentState.addOpperand (this, c);
         return c;
     }
 }