31 lines
830 B
Plaintext
Executable File
31 lines
830 B
Plaintext
Executable File
package com.fp.common.formula.functions;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import com.fp.common.formula.AbstractFunction;
|
|
|
|
/**
|
|
* @author
|
|
*/
|
|
public class Sum extends AbstractFunction {
|
|
|
|
@Override
|
|
public int getNumberOfParameters() {
|
|
return 5;
|
|
}
|
|
|
|
@Override
|
|
public Object eval() throws Exception {
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
// total = total.add(this.nextBigDecimalParameter());
|
|
// total = total.add(this.nextBigDecimalParameter());
|
|
// total = total.add(this.nextBigDecimalParameter());
|
|
// total = total.add(this.nextBigDecimalParameter());
|
|
// total = total.add(this.nextBigDecimalParameter());
|
|
for(int i=0; i<this.getNumberOfParameters(); i++){
|
|
total = total.add(this.nextBigDecimalParameter());
|
|
}
|
|
return total;
|
|
}
|
|
|
|
} |