I tested AIOTrade on newly downloaded JDK 6.0 beta 2, and got an exception instantly:
java.lang.ArrayIndexOutOfBoundsException: 0
at java.awt.geom.Path2D$Float.moveTo(Path2D.java:322)
at java.awt.geom.Path2D$Float.append(Path2D.java:643)
at java.awt.geom.Path2D.append(Path2D.java:1780)
The code run good in JDK 5.0, so will it be a regress bug in JDK 6.0?
I then checked the source code: 6.0 vs 5.0, and found there were likely a bit of code omited wrongly. That is, in method body of void needRoom(boolean needMove, int newCoords), should add
if (grow < 1) {
grow = 1;
}
at the next of:
int size = pointTypes.length;
if (numTypes >= size) {
int grow = size;
if (grow > EXPAND_MAX) {
grow = EXPAND_MAX;
}
The following is the proper code I've tested OK:
void needRoom(boolean needMove, int newCoords) {
if (needMove && numTypes == 0) {
throw new IllegalPathStateException("missing initial moveto "+
"in path definition");
}
int size = pointTypes.length;
if (numTypes >= size) {
int grow = size;
if (grow > EXPAND_MAX) {
grow = EXPAND_MAX;
}
/** fix bug:
* java.lang.ArrayIndexOutOfBoundsException: 0
* at java.awt.geom.Path2D$Float.moveTo(Path2D.java:322)
* at java.awt.geom.Path2D$Float.append(Path2D.java:643)
* at java.awt.geom.Path2D.append(Path2D.java:1780)
*/
if (grow < 1) {
grow = 1;
}
pointTypes = Arrays.copyOf(pointTypes, size+grow);
}
size = floatCoords.length;
if (numCoords + newCoords > size) {
int grow = size;
if (grow > EXPAND_MAX * 2) {
grow = EXPAND_MAX * 2;
}
if (grow < newCoords) {
grow = newCoords;
}
floatCoords = Arrays.copyOf(floatCoords, size+grow);
}
}
As I can not wait for it be fixed in JDK, so I wrote another org.aiotrade.util.awt.geom.Path2D and org.aiotrade.util.awt.geom.GeneralPath, and replaced the java.awt.geom.GeneralPath in my source tree. you can get the code at:
GeneralPath.java
Path2D.java
分享到:
相关推荐
资源来自pypi官网。 资源全名:regress-0.0.3.tar.gz
对农作物六种经典水分生产函数模型的相关数据进行拟合求函数中参数
regress_stata.do
plot_regress_accuary.py
MATLAB 回归分析regress,nlinfit,stepwise函数.pdfMATLAB 回归分析regress,nlinfit,stepwise函数.pdfMATLAB 回归分析regress,nlinfit,stepwise函数.pdfMATLAB 回归分析regress,nlinfit,stepwise函数.pdfMATLAB 回归...
数据为某公司三种销售渠道的广告投入和最终销售量,可以用于简单的线性回归分析和机器学习中的线性回归分析。
matlab的regress函数实现回归分析.zip
MS_Regress - The Matlab Package for Markov Regime Switching Models
Should not crash or raise an exception.
The test passes if it does not crash.
Ensure that we don t expose the builtins object when calling builtin functions that use or return "this".
利用matlab对多维自变量与单因变量的数据集寻找其联系的偏最小二乘回归方法,函数输入为自变量矩阵C,同维度列向量F,输出为最终的系数矩阵以及拟合值
matlab 多元与非线性回归即拟合问题regress、nlinfit
NULL 博文链接:https://springlin.iteye.com/blog/1520668
温州大学黄海广博士机器学习课程回归实战数据集。
bert模型训练,做回归任务,预测两句话的相似度;TensorFlow和keras单机四卡、多GPU训练模型代码,已经上线;
markov switching model (MS Regress)
基于keras的Bert模型训练,实现了网络冻结,自定义实现余弦距离作为相似度任务。主要训练两句话的深度语义匹配;
example08_01_regress.m