1 8 package org.lsmp.djep.groupJep.function; 9 import org.nfunk.jep.function.*; 10 import org.lsmp.djep.groupJep.*; 11 import org.lsmp.djep.groupJep.interfaces.*; 12 13 import java.util.*; 14 import org.nfunk.jep.*; 15 19 public class GList extends PostfixMathCommand { 20 private GroupI group; 21 24 private GList() { } 25 public GList(GroupI group) 26 { 27 numberOfParameters = -1; 28 this.group = group; 29 } 30 31 35 public void run(Stack stack) throws ParseException { 36 checkStack(stack); if(!(group instanceof HasListI)) 38 throw new ParseException("List not defined for this group"); 39 Number res[] = new Number [curNumberOfParameters]; 40 for(int i=curNumberOfParameters-1;i>=0;--i) { 42 res[i] = (Number ) stack.pop(); 43 } 44 stack.push(((HasListI) group).list(res)); 45 return; 46 } 47 } 48 | Popular Tags |