Looks to me like the problem is the open curly at line 24:
if (!cnodes.contains(node)) {
cnodes.add(node);
or rather the lack of a close brace.
This means that if the condition is true, you skip all the way down to the end, past your return statements.
jon.kiparsky
Posting Virtuoso
1,849 posts since Jun 2010
Reputation Points: 383
Solved Threads: 187
public boolean FailurePoint(int selectedNodes[], CyNetwork network) {
int kids[] = network.getAdjacentEdgeIndicesArray(selectedNodes[0], false, true, true);
int[] ChildNode = new int[kids.length];
for (int c = 0; c < ChildNode.length; c++) {
int node = network.getEdgeSourceIndex(kids[c]);
if (node == selectedNodes[0]) {
node = network.getEdgeTargetIndex(kids[c]);
}
ChildNode[c] = node;
}
Vector<Integer> cnodes = new Vector<Integer>();
for (int c = 0; c < ChildNode.length; c++) {
int node = ChildNode[c];
if (!cnodes.contains(node)) {
cnodes.add(node);
}
}
boolean FailurePoint;
for (int i = 1; i < cnodes.size(); i++) {
boolean isConnected = hasPath(cnodes.elementAt(0), cnodes.elementAt(i), selectedNodes[0], network);
boolean OneKid = false;
if (cnodes.size() < 2) {
OneKid = true;
}
//boolean FailurePoint;
if ((isConnected == true) || (OneKid == true)) {
FailurePoint = false;
//return false;
} else {
FailurePoint = true;
//return true;
}
}
return FailurePoint;
}
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
Initialize the variable to a default value, whichever would make more sense as a default for your usage.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847