first commit
This commit is contained in:
20
hrmsEjb/org/nfunk/jep/function/List.java
Normal file
20
hrmsEjb/org/nfunk/jep/function/List.java
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user