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