Next version of JABA
[jabaws.git] / datamodel / compbio / data / sequence / AlignmentMetadata.java
1 /* Copyright (c) 2009 Peter Troshin\r
2  *  \r
3  *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.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 \r
19 package compbio.data.sequence;\r
20 \r
21 import javax.xml.bind.annotation.XmlAccessType;\r
22 import javax.xml.bind.annotation.XmlAccessorType;\r
23 \r
24 import compbio.util.annotation.Immutable;\r
25 \r
26 /**\r
27  * Alignment metadata e.g. method/program being used to generate the alignment\r
28  * and its parameters\r
29  * \r
30  * @author pvtroshin\r
31  * \r
32  *         Date September 2009\r
33  */\r
34 @Immutable\r
35 @XmlAccessorType(XmlAccessType.FIELD)\r
36 public class AlignmentMetadata {\r
37 \r
38     private Program program;\r
39     private char gapchar;\r
40 \r
41     private AlignmentMetadata() {\r
42         // Default no args constructor required for JAXB\r
43     }\r
44 \r
45     public AlignmentMetadata(Program program, char gapchar) {\r
46         this.program = program;\r
47         this.gapchar = gapchar;\r
48     }\r
49 \r
50     public Program getProgram() {\r
51         return program;\r
52     }\r
53 \r
54     public char getGapchar() {\r
55         return gapchar;\r
56     }\r
57 \r
58     @Override\r
59     public boolean equals(Object obj) {\r
60         if (obj == null) {\r
61             return false;\r
62         }\r
63         if (!(obj instanceof AlignmentMetadata)) {\r
64             return false;\r
65         }\r
66         AlignmentMetadata alm = (AlignmentMetadata) obj;\r
67         if (alm.getProgram() != this.getProgram()) {\r
68             return false;\r
69         }\r
70         if (alm.getGapchar() != this.getGapchar()) {\r
71             return false;\r
72         }\r
73         return true;\r
74     }\r
75 \r
76     @Override\r
77     public int hashCode() {\r
78         return getProgram().hashCode() * getGapchar() * 13;\r
79     }\r
80 \r
81 }\r