Debian Codegraph @

current/jasper/NCBIComparison.java

raw symbols SCIP
1 package jasper;
2
3 public class NCBIComparison implements Comparable<NCBIComparison> {
4
5 /**
6 * Object for storing sequence similarity values between two nodes
7 * @param queryID_ int Node ID of the primary query sequence.
8 * @param refID_ int Node ID of the reference sequence.
9 * @param identity_ double similarity value between both nodes.
10 */
11 public NCBIComparison(int queryID_, int refID_, double identity_) {
12
13 //Set the queryID as the input value
14 this.queryID = queryID_;
15
16 //Set the refID as the input value
17 this.refNodeID = refID_;
18
19 //Set the identity as the input value
20 this.identity = identity_;
21 }
22
23
24 /**
25 * toString method to return the queryID, the refID and the similarity with some formatting.
26 */
27 public String toString() {
28 return "Query node ID = " + queryID + ", Reference node ID = " + refNodeID +
29 ", Similarity identity = " + identity;
30 }
31
32 /**
33 * Allows sorting of Comparison objects in an ArrayList<Comparison>
34 */
35 public int compareTo(NCBIComparison comparison){
36
37 //If the identity of this comparison is equal to another comparison, return 0.
38 if(identity == comparison.identity) {
39 return 0;
40
41 //but if the identity of this Comparison is greater than another, return 1.
42 }else if(identity < comparison.identity) {
43 return 1;
44
45 //The only remaining option is that the identity of this Comparison is less than another Comparison.
46 //Return -1
47 }else {
48 return -1;
49 }
50 }
51
52 /**
53 * Current node/organism of focus.
54 */
55 int queryID;
56
57 /**
58 * Node being compared to the queryID node.
59 */
60 int refNodeID;
61
62 /**
63 * Similarity between the queryID node and the refID node.
64 */
65 double identity;
66
67 }