-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding function existsPath together with test #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, see inline annotations.
Also, I'd rather have this in algo.OntologyTerms to keep the Ontology
interfaces slim and rather have utility classes with static functions.
@@ -1,9 +1,6 @@ | |||
package com.github.phenomics.ontolib.ontology.data; | |||
|
|||
import java.util.Collection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no star imports but explicit ones. I guess you can easily adjust your IDE to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I forgot: please add note to Changelog.
@Override | ||
public boolean existsPath(final TermId sourceID, TermId destID){ | ||
// special case -- a term cannot have a path to itself in an ontology (DAG) | ||
if (sourceID.equals(destID)) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap and indent consistently. I can send around a style file for Eclipse.
}}); | ||
return visited.contains(destID); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove superflous whitespace for consistencty.
@@ -97,6 +97,9 @@ default TermId getPrimaryTermId(TermId termId) { | |||
return result; | |||
} | |||
|
|||
public boolean existsPath(final TermId sourceID, TermId destID); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add javadoc and remove superflous empty lines.
/** The example graph has id1->id2, id1->id3, id1->id4, id2->id5, id4->id5 */ | ||
@Test | ||
public void testPathExists() { | ||
assertTrue(ontology.existsPath(id1,id2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make whitespace consistent, your IDE should offer an option to do this automatically.
assertFalse(ontology.existsPath(id5,id4)); | ||
// test that a term cannot have a path to itself. | ||
assertFalse(ontology.existsPath(id5,id5)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove empty line here and below.
I have replaced this PR with PR #39 and will close this |
No description provided.