Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

pnrobinson
Copy link
Collaborator

No description provided.

Copy link
Contributor

@holtgrewe holtgrewe left a 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;
Copy link
Contributor

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.

Copy link
Contributor

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;
Copy link
Contributor

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);
}

Copy link
Contributor

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);

Copy link
Contributor

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));
Copy link
Contributor

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));

Copy link
Contributor

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.

@pnrobinson
Copy link
Collaborator Author

I have replaced this PR with PR #39 and will close this

@pnrobinson pnrobinson closed this Jan 17, 2018
@pnrobinson pnrobinson deleted the existpath branch January 17, 2018 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants