[英]Creating a Table data structure in Prefuse
I'm trying to creating a Graph instance in Prefuse through the following approach: 我正在尝试通过以下方法在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.
*/
So I create a Table object to store the nodes and edges data like this. 因此,我创建了一个Table对象来存储节点和边数据,就像这样。 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 API将方法“ addColumn”描述为
public void addColumn(java.lang.String name,
java.lang.Class type)
Add a column with the given name and data type to this table. 在此表中添加具有给定名称和数据类型的列。
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.
对于Java Prefuse,如果您尝试将类型设置为int,则只需使用int.class即可获取类名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.