1

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user533203
  • 81
  • 1
  • 1
  • 4

1 Answers1

1

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.

dliffen
  • 11
  • 1