package org.nfunk.jep.function;

import java.util.Stack;
import java.util.Vector;
import org.nfunk.jep.ParseException;

public class List extends PostfixMathCommand {
  public void run(Stack paramStack) throws ParseException {
    checkStack(paramStack);
    if (this.curNumberOfParameters < 1)
      throw new ParseException("Empty list"); 
    Vector vector = new Vector(this.curNumberOfParameters);
    vector.setSize(this.curNumberOfParameters);
    for (int i = this.curNumberOfParameters - 1; i >= 0; i--) {
      Object object = paramStack.pop();
      vector.setElementAt(object, i);
    } 
    paramStack.push(vector);
  }
}
