zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.changhong.epc.parsing.service.autosubmit.tool.function;
 
import java.util.Map;
 
import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.type.AviatorDouble;
import com.googlecode.aviator.runtime.type.AviatorObject;
 
import com.changhong.epc.parsing.service.autosubmit.info.FormCpn;
import com.changhong.epc.parsing.service.autosubmit.tool.FormCpnTool;
 
/**
 * 汇总函数
 * @author WangYX
 *
 */
public class Sum extends AbstractFunction{
 
    @Override
    public String getName() {
        return "SUM";
    }
 
    @Override
    public AviatorObject call(Map<String, Object> env, AviatorObject cpnKey) {
        Object cpnObj = cpnKey.getValue(env);
        if(!(cpnObj instanceof FormCpn))
            return new AviatorDouble(0);
        return new AviatorDouble(FormCpnTool.sumValByCpn((FormCpn) cpnObj));
    }
    
}