//System.out.println("functionXY" + nX + " " + nY + " " + functionName);
float[][] fxy = new float[Math.abs(nX)][Math.abs(nY)];
if (!mayScript || nX == 0 || nY == 0)
return fxy;
try {
JSObject jsoWindow = JSObject.getWindow(appletWrapper);
if (nX > 0 && nY > 0) { // fill with individual function calls (slow)
for (int i = 0; i < nX; i++)
for (int j = 0; j < nY; j++) {
fxy[i][j] = ((Double) jsoWindow.call(functionName, new Object[] {
htmlName, new Integer(i), new Integer(j) })).floatValue();
}
} else if (nY > 0) { // fill with parsed values from a string (pretty fast)
String data = (String) jsoWindow.call(functionName, new Object[] {
htmlName, new Integer(nX), new Integer(nY) });
//System.out.println(data);
nX = Math.abs(nX);
float[] fdata = new float[nX * nY];
Parser.parseStringInfestedFloatArray(data, null, fdata);
for (int i = 0, ipt = 0; i < nX; i++) {
for (int j = 0; j < nY; j++, ipt++) {
fxy[i][j] = fdata[ipt];
}
}
} else { // fill float[][] directly using JavaScript
jsoWindow.call(functionName, new Object[] { htmlName,
new Integer(nX), new Integer(nY), fxy });
}
} catch (Exception e) {
Logger.error("Exception " + e.getMessage() + " with nX, nY: " + nX
+ " " + nY);