1 9 10 package org.nfunk.jep.function; 11 12 import java.util.*; 13 import org.nfunk.jep.*; 14 import org.nfunk.jep.type.*; 15 21 public class Polar extends PostfixMathCommand 22 { 23 public Polar() 24 { 25 numberOfParameters = 2; 26 } 27 28 public void run(Stack inStack) 29 throws ParseException 30 { 31 checkStack(inStack); Object param2 = inStack.pop(); 33 Object param1 = inStack.pop(); 34 35 if ((param1 instanceof Number ) && (param2 instanceof Number )) 36 { 37 inStack.push(Complex.polarValueOf((Number ) param1,(Number ) param2)); 38 } 39 else 40 { 41 throw new ParseException("Complex: Invalid parameter types "+param1.getClass().getName()+" "+param1.getClass().getName()); 42 } 43 return; 44 } 45 } 46 | Popular Tags |