public void Clear() { total = new Complex (0, 0); currentState = StartState.Singleton; //_pendingOp = _noOp; // System.out.println("Clear All!"); }
public Complex enterRectOperand(String input) { String [] parts = input.Trim ().Split (); if (parts.Length ==0 || parts.Length>2) { currentState = ErrorState.Singleton; return null; } else if (parts.Length == 1) { Complex c = new Complex(Double.Parse(parts[0]), 0); currentState.addOpperand(this, c); return c; } else { Complex c = new Complex(Double.Parse(parts[0]), Double.Parse(parts[1])); currentState.addOpperand(this, c); return 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; } }