在 Prefuse 中创建表数据结构
我尝试通过以下方法在 Prefuse 中创建一个 Graph 实例:
Graph(Table nodes, Table edges, boolean directed)
/*
Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
*/
因此,我创建一个 Table 对象来存储这样的节点和边数据。然而,这是一个问题:
Table nodes=new Table(2,3);
//here is the error eclipse reports:integer can't be resolved to a variable
nodes.addColumn("id",integer);
nodes.addColumn("name", String);
nodes.addColumn("gender", String);
nodes.addRows(4);
nodes.set(0, 0, 1);
nodes.set(0, 1, "Abbas");
nodes.set(0, 2, "M");
nodes.set(1, 0, 2);
nodes.set(1, 1, "Hassan");
nodes.set(1, 2, "F");
API 将方法“addColumn”描述为“
public void addColumn(java.lang.String name,
java.lang.Class type)
向此表添加具有给定名称和数据类型的列”。
I'm trying to creating a Graph instance in Prefuse through the following approach:
Graph(Table nodes, Table edges, boolean directed)
/*
Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
*/
So I create a Table object to store the nodes and edges data like this. However, this is a problem:
Table nodes=new Table(2,3);
//here is the error eclipse reports:integer can't be resolved to a variable
nodes.addColumn("id",integer);
nodes.addColumn("name", String);
nodes.addColumn("gender", String);
nodes.addRows(4);
nodes.set(0, 0, 1);
nodes.set(0, 1, "Abbas");
nodes.set(0, 2, "M");
nodes.set(1, 0, 2);
nodes.set(1, 1, "Hassan");
nodes.set(1, 2, "F");
The API describes the method "addColumn" as
public void addColumn(java.lang.String name,
java.lang.Class type)
Add a column with the given name and data type to this table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是输入整数会让编译器认为您正在尝试让它访问变量,因为整数不是关键字。对于 Java Prefuse,如果您尝试将类型设置为 int,则只需使用 int.class 来获取类名。
Just putting integer makes the compiler think that you are trying to get it to access a variable since integer is not a keyword. In the case of Java Prefuse if you are trying to set the type to int then just use int.class to get the class name.