Can't find constructor.

T

tolu45

Hi,

I have some problems with my java code. I Have 2 class SelGraphNode and
SelGraph. Both have constructors. The problems is when i instantiate
Node in SeleGraph,I get an error saying:
Can't find symbol
Symbol: Constructor SelGraphNode
Find Below the code for the 2 constructors:

for SelGraph:

public class SelGraph {

SelGraphNode nodes = new SelGraphNode();
//SelGrapNode node1 = new SelGrapNode();
ArrayList<SelGraphEdge> edgesList = new ArrayList<SelGraphEdge>();
ArrayList<SelGraphNode> nodesList = new ArrayList<SelGraphNode>();
//Vector edges = new Vector();
Vector table_list = new Vector();
Vector condition_list = new Vector();
Vector join_list = new Vector();

/** Creates a new instance of SelGraph */
public SelGraph(SelGraphNode N,SelGraphEdge E) {
nodes = N;
}

complete code for SelGraphNode() :

public class SelGraphNode {

public String table_name = new String();
public Vector condition = new Vector();
public boolean node_flag;
public String primary_key = new String();


/** Creates a new instance of SelGrapNode */
public SelGraphNode(String table_name, Vector condition, boolean
node_flag, String primary_key) {
this.table_name = table_name;
this.condition = condition;
this.node_flag = node_flag;
this.primary_key = primary_key;
}

public String getTableName () { return table_name; }
public Vector getCondition () { return condition; }
public boolean getNodeFlag () { return node_flag;}
public String getPrimaryKey () { return primary_key; }

}

Your help will be appreciated
 
T

tolu45

the selection graph code. Besides when i tried to instantiate the
selGraph class, I got the same message. This was how i instantiated
it:SelGraph selGraph1 = new SelGraph(new SelGraphNode("movie", "",
true, "id"));
 
C

chris_k

Hi,

You are missing to explicitly provide the default no-args constructor
of class SelGraphNode

HTH,
chris
 
Z

zero

Hi,

I have some problems with my java code. I Have 2 class SelGraphNode
and SelGraph. Both have constructors. The problems is when i
instantiate Node in SeleGraph,I get an error saying:
Can't find symbol
Symbol: Constructor SelGraphNode
Find Below the code for the 2 constructors:

for SelGraph:

public class SelGraph {

SelGraphNode nodes = new SelGraphNode();

This is your problem. You're calling a constructor without arguments,
but...
//SelGrapNode node1 = new SelGrapNode();
ArrayList<SelGraphEdge> edgesList = new ArrayList<SelGraphEdge>();
ArrayList<SelGraphNode> nodesList = new ArrayList<SelGraphNode>();
//Vector edges = new Vector();
Vector table_list = new Vector();
Vector condition_list = new Vector();
Vector join_list = new Vector();

/** Creates a new instance of SelGraph */
public SelGraph(SelGraphNode N,SelGraphEdge E) {
nodes = N;
}

complete code for SelGraphNode() :

public class SelGraphNode {

public String table_name = new String();
public Vector condition = new Vector();
public boolean node_flag;
public String primary_key = new String();


/** Creates a new instance of SelGrapNode */
public SelGraphNode(String table_name, Vector condition, boolean
node_flag, String primary_key) {
this.table_name = table_name;
this.condition = condition;
this.node_flag = node_flag;
this.primary_key = primary_key;
}

....SelGraphNode only has a constructor with 4 arguments. Add a
no-argument constructor. Or just remove the new SelGraphNode() part, as
variable nodes is instantiated in the constructor anyway.

Also, you're mixing typed collections (ArrayList<SelGraphEdge>
edgesList) with raw collections(Vector table_list). What's the
reasoning behind that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top