ensure we never check in autogenerated documentation or build artefacts
[jabaws.git] / runner / compbio / pipeline / _jpred / Hit.java
1 /* Copyright (c) 2011 Peter Troshin\r
2  *  \r
3  *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
4  * \r
5  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
6  *  Apache License version 2 as published by the Apache Software Foundation\r
7  * \r
8  *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
9  *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
10  *  License for more details.\r
11  * \r
12  *  A copy of the license is in apache_license.txt. It is also available here:\r
13  * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
14  * \r
15  * Any republication or derived work distributed in source code form\r
16  * must include this copyright and license notice.\r
17  */\r
18 package compbio.pipeline._jpred;\r
19 \r
20 import java.util.Comparator;\r
21 \r
22 public class Hit {\r
23     String name;\r
24     String number;\r
25     String accession;\r
26     String seq;\r
27     String evalue;\r
28 \r
29     @Override\r
30     public String toString() {\r
31         return "accession=" + accession + ", name=" + name + ", num=" + number\r
32                 + ", evalue=" + evalue + "\n"; // + ", seq=" + seq +\r
33     }\r
34 \r
35     @Override\r
36     public int hashCode() {\r
37         final int prime = 31;\r
38         int result = 1;\r
39         result = prime * result + ((name == null) ? 0 : name.hashCode());\r
40         return result;\r
41     }\r
42 \r
43     @Override\r
44     public boolean equals(Object obj) {\r
45         if (this == obj)\r
46             return true;\r
47         if (obj == null)\r
48             return false;\r
49         if (getClass() != obj.getClass())\r
50             return false;\r
51         Hit other = (Hit) obj;\r
52         if (name == null) {\r
53             if (other.name != null)\r
54                 return false;\r
55         } else if (!name.equals(other.name))\r
56             return false;\r
57         return true;\r
58     }\r
59 \r
60     public static final class NumberComporator implements Comparator<Hit> {\r
61         @Override\r
62         public int compare(Hit o1, Hit o2) {\r
63             return Integer.valueOf(o1.number).compareTo(\r
64                     Integer.valueOf(o2.number));\r
65         }\r
66     }\r
67 \r
68     public static final class EvalueComporator implements Comparator<Hit> {\r
69         @Override\r
70         public int compare(Hit o1, Hit o2) {\r
71             return Double.valueOf(o1.evalue).compareTo(\r
72                     Double.valueOf(o2.evalue));\r
73         }\r
74     }\r
75 }