Hello, I'm a biologist trying to do some bioinformatics, so new to Java and new to this forum. I've searched all over the forum for previous threads on this topic, but can't find an answer that has helped me. Apologies if I've missed something already posted that may help solve my problem. I'm currently trying to write a method that will return a boolean true or false. I am getting an error though saying 'missing return statement'. I can't for the life of me work out what the issue is. I've tried changing the braces, rearranging the remove statements in and around the braces, but no luck.
public boolean FailurePoint(int selectedNodes[], CyNetwork network) {
//error is here 'missing return statement'
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);
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;
}
else {
OneKid = false;
}
boolean FailurePoint;
if ((isConnected == true) || (OneKid == true)) {
FailurePoint = false;
return false;
}
else {
FailurePoint = true;
return true;
}
return FailurePoint;
}
}
}
I have tried writing the last piece as follows but get the exact same error:
if ((isConnected == true) || (OneKid == true)) {
return false;
} else {
return true;
}
}
}
}
I know all the braces don't tally up here, but there are other methods and class above, this. I didn't think it necessary to clog up space with all that code too.
I'll be grateful for any help, thanks in advance :icon_smile: