public void Clear() { total = 0; opperand1=0; opperand2=0; currentState = StartState.Singleton; //_pendingOp = _noOp; // System.out.println("Clear All!"); }
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; } }
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); } }
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; } }