我无法确定数组的类型
I can not determine the type of Array
我的客户端 (As3) 将这个数组发送到我的服务器 (Java) 到一个函数:
{2={y=16.0, x=17.0}, 1={y=17.0, x=17.0}, 0={y=18.0, x=17.0}}
但是我无法确定类型。
我尝试过:String[]、Object[] 等..
服务器端:
public void MaSuperFonction(Object[] $path){ ... }
客户端:
this.groupedList[0] = {x:this.startX,y:this.startY};
this.groupedList[1] = {x:this.startX,y:this.startY};
this.groupedList[2] = {x:this.startX,y:this.startY};
var path = this.groupedList[0];
if(this.groupedList.length > 1)
{
var i = 1;
while(i < this.groupedList.length)
{
path = path.concat(this.groupedList[i]);
i = i + 1;
}
}
this.nc.call('MaSuperFonction',path);
但是没有成功。
Method MaSuperFonction with parameters [{2={y=16.0, x=17.0}, 1={y=17.0, x=17.0}, 0={y=18.0, x=17.0}}] not found
看起来您的客户端正在发送二维双精度数组,请参阅下面的示例代码,了解如何创建二维双精度数组并对其进行迭代:-
public class SOArrayTest {
public static void main(String[] args) {
double[][] a = new double[3][2];
a[0][0] = 16.0;
a[0][1] = 17.0;
a[1][0] = 18.0;
a[1][1] = 19.0;
a[2][0] = 20.0;
a[2][1] = 21.0;
for(int i=0; i<3; i++) {
for(int j=0; j<2; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}
}
你也可以喜欢上面的代码,稍作修改接受它,在服务器端的二维双数组中。
我宁愿说它是一个Map<Integer, Point>>
,其中Point
class可以声明为:
class Point {
private Double x;
private Double y;
// getters/setters
}
你应该明白这是一个key=value对的序列,不能用数组来表示(每个cell只包含一个元素)
我的客户端 (As3) 将这个数组发送到我的服务器 (Java) 到一个函数:
{2={y=16.0, x=17.0}, 1={y=17.0, x=17.0}, 0={y=18.0, x=17.0}}
但是我无法确定类型。
我尝试过:String[]、Object[] 等..
服务器端:
public void MaSuperFonction(Object[] $path){ ... }
客户端:
this.groupedList[0] = {x:this.startX,y:this.startY};
this.groupedList[1] = {x:this.startX,y:this.startY};
this.groupedList[2] = {x:this.startX,y:this.startY};
var path = this.groupedList[0];
if(this.groupedList.length > 1)
{
var i = 1;
while(i < this.groupedList.length)
{
path = path.concat(this.groupedList[i]);
i = i + 1;
}
}
this.nc.call('MaSuperFonction',path);
但是没有成功。
Method MaSuperFonction with parameters [{2={y=16.0, x=17.0}, 1={y=17.0, x=17.0}, 0={y=18.0, x=17.0}}] not found
看起来您的客户端正在发送二维双精度数组,请参阅下面的示例代码,了解如何创建二维双精度数组并对其进行迭代:-
public class SOArrayTest {
public static void main(String[] args) {
double[][] a = new double[3][2];
a[0][0] = 16.0;
a[0][1] = 17.0;
a[1][0] = 18.0;
a[1][1] = 19.0;
a[2][0] = 20.0;
a[2][1] = 21.0;
for(int i=0; i<3; i++) {
for(int j=0; j<2; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}
}
你也可以喜欢上面的代码,稍作修改接受它,在服务器端的二维双数组中。
我宁愿说它是一个Map<Integer, Point>>
,其中Point
class可以声明为:
class Point {
private Double x;
private Double y;
// getters/setters
}
你应该明白这是一个key=value对的序列,不能用数组来表示(每个cell只包含一个元素)