Posted on 2010-01-06 00:44
leekiang 閱讀(1115)
評論(0) 編輯 收藏 所屬分類:
java
JEP
http://www.singularsys.com/jep/
https://sourceforge.net/projects/jep/
http://rabbit8.bokee.com/3936531.html
http://suneca.com/article.asp?id=28
http://www.javaeye.com/topic/58422里辦法多
關于jexl
1,jexl1.1計算分母為0的表達式時,竟然算出來的值為0,被某人說沒有邏輯https://issues.apache.org/jira/browse/JEXL-45
2,jexl2解決了這個問題,但jexl2依賴jdk5
https://issues.apache.org/jira/browse/JEXL-58
handles ArithmeticException (divide by zero)
division by zero ignored only if JexlEngine.isSilent()
JexlEngine?jexl?=?new?JexlEngine();
jexl.setCache(512);//有何用
jexl.setLenient(false);//什么意思
jexl.setSilent(false);
String?calculate?=?"(G1?+?G2)/2";
Expression?e?=jexl.createExpression(calculate);
//?populate?the?context
JexlContext?context?=?new?MapContext();
context.set("G1",?"3");
context.set("G2",?"5");
Object?res?=?e.evaluate(context);//silent為false時evaluate方法會拋異常,為true不拋異常但res為null
??? ??? ???
另外,利用oracle計算,如果分母為0會報ORA-01476: divisor is equal to zero