package com.sgai.mes.function;import com.sgai.exp.ExpressionContext;
import com.sgai.exp.math.function.BaseFunction;public class CharLengthFunction extends BaseFunction{ public String getName() {
// TODO Auto-generated method stub
return "CALCULATE_CHAR_LENGTH" ;
} public String perform(ExpressionContext expCtx, String[] arg) {
// TODO Auto-generated method stub
if (arg==null || arg.length==0) return "0";
String outMatId=null;
String targetCtxPath = null;
//上下文中保存物料号的参数ID
targetCtxPath = arg[0];
if (targetCtxPath==null ||
targetCtxPath.trim().equals("")||
targetCtxPath.equals("NEX")) {
targetCtxPath = "mat";
}
outMatId = arg[1];
String length=String.valueOf(outMatId.length());
return length;
}
}
=========================================
CALCULATE_CHAR_LENGTH(mat,mat\matWidth,NEX) 外部是怎么调的;
我看外部传进去了三个参数,public String perform(ExpressionContext expCtx, String[] arg)这里只声明了两个,取前两个还是怎么着,初学,求教啊!!!
import com.sgai.exp.math.function.BaseFunction;public class CharLengthFunction extends BaseFunction{ public String getName() {
// TODO Auto-generated method stub
return "CALCULATE_CHAR_LENGTH" ;
} public String perform(ExpressionContext expCtx, String[] arg) {
// TODO Auto-generated method stub
if (arg==null || arg.length==0) return "0";
String outMatId=null;
String targetCtxPath = null;
//上下文中保存物料号的参数ID
targetCtxPath = arg[0];
if (targetCtxPath==null ||
targetCtxPath.trim().equals("")||
targetCtxPath.equals("NEX")) {
targetCtxPath = "mat";
}
outMatId = arg[1];
String length=String.valueOf(outMatId.length());
return length;
}
}
=========================================
CALCULATE_CHAR_LENGTH(mat,mat\matWidth,NEX) 外部是怎么调的;
我看外部传进去了三个参数,public String perform(ExpressionContext expCtx, String[] arg)这里只声明了两个,取前两个还是怎么着,初学,求教啊!!!
解决方案 »
- 高分求助:hibernate annotations工具生成的pojo类的控制反转问题
- 请问activemq消息发送机制有连接超时这种情况发生吗?
- 重复刷新的问题?
- hibernate动态模型如何进行多表查询
- 一个关于servlet的问题
- weblogic中classpath和web appliaction中lib下,有版本不同的两个jar包,会加载哪个?
- 在Windows 2000下如何配置JSP+Weblogic8.0
- 关于配置tomcat后释放连接池的问题,请赐教!
- 寻求Tomcat的Jsp api的文档?
- JBUILDER8和JBOSS3.04(与TOMCAT4.1合成)能够实现WEB SERVICE功能的开发吗?
- jetty页面显示不正常,打成war包发布到glassfish后,页面显示正常,为啥??请大神指点迷津!!
- WebService客户端
import com.sgai.exp.math.function.BaseFunction;public class CharLengthFunction extends BaseFunction{ public String getName() {
// TODO Auto-generated method stub
return "CALCULATE_CHAR_LENGTH" ; --返回本类的名字
} public String perform(ExpressionContext expCtx, String[] arg) {
// TODO Auto-generated method stub
if (arg==null || arg.length==0) return "0"; --如果arg[0]为空或者字符串长度为0,返回0
String outMatId=null;
String targetCtxPath = null;
//上下文中保存物料号的参数ID
targetCtxPath = arg[0];
if (targetCtxPath==null ||
targetCtxPath.trim().equals("")||
targetCtxPath.equals("NEX")) {
targetCtxPath = "mat";
}
outMatId = arg[1]; --如果targetCtxPath为空或者=""或者="NEX"或者="mat",outMatId=arg[1]
String length=String.valueOf(outMatId.length()); --求outMatId长度并返回长度值
return length;
}
}这个是我自己写的注释,帮忙看看理解是否有误。
import com.sgai.exp.math.function.BaseFunction;public class CharLengthFunction extends BaseFunction { public String getName() {
// TODO Auto-generated method stub
return "CALCULATE_CHAR_LENGTH" ; //返回一个字符串"CALCULATE_CHAR_LENGTH"。
} public String perform(ExpressionContext expCtx, String[] arg) {
// TODO Auto-generated method stub if (arg==null || arg.length==0)
return "0"; //如果数组arg为空或者数组arg长度为0,返回字符串"0"。
String outMatId=null;//初始定义字符串变量outMatId。
String targetCtxPath = null;//初始定义字符串变量targetCtxPath。
//上下文中保存物料号的参数ID
targetCtxPath = arg[0];//给字符串变量targetCtxPath赋值。因为上面以判断字符串数组arg部位空且长度大于0,所以可以这样赋值。
if (targetCtxPath==null ||
targetCtxPath.trim().equals("")||
targetCtxPath.equals("NEX")) {
targetCtxPath = "mat";//如果字符串变量targetCtxPath为null,或者为"",或者为"NEX"值时,将targetCtxPath赋值为"mat"。
}
outMatId = arg[1]; //将outMatId赋值为arg[1],此代码有风险,若传进来的arg的长度为1,此处则会抛出越界异常。
String length=String.valueOf(outMatId.length()); //是将outMatId的长度值转化为字符串。
return length;
}
}