ensure we never check in autogenerated documentation or build artefacts
[jabaws.git] / runner / compbio / pipeline / _jpred / PScore.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 public class PScore {\r
21 \r
22         String name; \r
23         String otherName;\r
24         double score; \r
25         \r
26         \r
27         @Override\r
28         public boolean equals(Object obj) {\r
29                 if(obj==null) { \r
30                         return false; \r
31                 }\r
32                 if(!(obj instanceof PScore)) { \r
33                         return false; \r
34                 }\r
35                 PScore pscore = (PScore)obj; \r
36                 if(Double.compare(score, pscore.score)!=0) {\r
37                         return false; \r
38                 }\r
39                 if(!this.name.equalsIgnoreCase(pscore.name)) {\r
40                         return false; \r
41                 }\r
42                 if(!this.otherName.equalsIgnoreCase(pscore.otherName)) {\r
43                         return false; \r
44                 }\r
45                 return true;\r
46         }\r
47         \r
48         @Override\r
49         public int hashCode() {\r
50                 return new Double((name.hashCode() * otherName.hashCode()*45)/score).intValue();\r
51         }\r
52         \r
53         @Override\r
54         public String toString() {\r
55                 String value = "Name: " + name + "\n";\r
56                 value += "OtherName: " + otherName+ "\n";\r
57                 value += "Score: " + score+ "\n";\r
58                 return value;\r
59         }\r
60 }\r