1 9 10 package org.nfunk.jep.function; 11 12 import java.util.*; 13 import org.nfunk.jep.*; 14 15 21 public class List extends PostfixMathCommand 22 { 23 public List() 24 { 25 numberOfParameters = -1; 26 } 27 28 public void run(Stack inStack) 29 throws ParseException 30 { 31 checkStack(inStack); if(curNumberOfParameters <1) 33 throw new ParseException("Empty list"); 34 Vector res = new Vector(curNumberOfParameters); 35 res.setSize(curNumberOfParameters); 36 for(int i=curNumberOfParameters-1;i>=0;--i) 37 { 38 Object param = inStack.pop(); 39 res.setElementAt(param,i); 40 } 41 inStack.push(res); 42 return; 43 } 44 } 45 | Popular Tags |