JAL-1503 update version in GPL header
[jalview.git] / src / vamsas / objects / simple / Alignment.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package vamsas.objects.simple;
20
21 public class Alignment extends vamsas.objects.simple.Object implements
22         java.io.Serializable
23 {
24   private java.lang.String gapchar;
25
26   private java.lang.String[] method;
27
28   private vamsas.objects.simple.SequenceSet seqs;
29
30   public Alignment()
31   {
32   }
33
34   public Alignment(java.lang.String gapchar, java.lang.String[] method,
35           vamsas.objects.simple.SequenceSet seqs)
36   {
37     this.gapchar = gapchar;
38     this.method = method;
39     this.seqs = seqs;
40   }
41
42   /**
43    * Gets the gapchar value for this Alignment.
44    * 
45    * @return gapchar
46    */
47   public java.lang.String getGapchar()
48   {
49     return gapchar;
50   }
51
52   /**
53    * Sets the gapchar value for this Alignment.
54    * 
55    * @param gapchar
56    */
57   public void setGapchar(java.lang.String gapchar)
58   {
59     this.gapchar = gapchar;
60   }
61
62   /**
63    * Gets the method value for this Alignment.
64    * 
65    * @return method
66    */
67   public java.lang.String[] getMethod()
68   {
69     return method;
70   }
71
72   /**
73    * Sets the method value for this Alignment.
74    * 
75    * @param method
76    */
77   public void setMethod(java.lang.String[] method)
78   {
79     this.method = method;
80   }
81
82   /**
83    * Gets the seqs value for this Alignment.
84    * 
85    * @return seqs
86    */
87   public vamsas.objects.simple.SequenceSet getSeqs()
88   {
89     return seqs;
90   }
91
92   /**
93    * Sets the seqs value for this Alignment.
94    * 
95    * @param seqs
96    */
97   public void setSeqs(vamsas.objects.simple.SequenceSet seqs)
98   {
99     this.seqs = seqs;
100   }
101
102   private java.lang.Object __equalsCalc = null;
103
104   public synchronized boolean equals(java.lang.Object obj)
105   {
106     if (!(obj instanceof Alignment))
107       return false;
108     Alignment other = (Alignment) obj;
109     if (obj == null)
110       return false;
111     if (this == obj)
112       return true;
113     if (__equalsCalc != null)
114     {
115       return (__equalsCalc == obj);
116     }
117     __equalsCalc = obj;
118     boolean _equals;
119     _equals = super.equals(obj)
120             && ((this.gapchar == null && other.getGapchar() == null) || (this.gapchar != null && this.gapchar
121                     .equals(other.getGapchar())))
122             && ((this.method == null && other.getMethod() == null) || (this.method != null && java.util.Arrays
123                     .equals(this.method, other.getMethod())))
124             && ((this.seqs == null && other.getSeqs() == null) || (this.seqs != null && this.seqs
125                     .equals(other.getSeqs())));
126     __equalsCalc = null;
127     return _equals;
128   }
129
130   private boolean __hashCodeCalc = false;
131
132   public synchronized int hashCode()
133   {
134     if (__hashCodeCalc)
135     {
136       return 0;
137     }
138     __hashCodeCalc = true;
139     int _hashCode = super.hashCode();
140     if (getGapchar() != null)
141     {
142       _hashCode += getGapchar().hashCode();
143     }
144     if (getMethod() != null)
145     {
146       for (int i = 0; i < java.lang.reflect.Array.getLength(getMethod()); i++)
147       {
148         java.lang.Object obj = java.lang.reflect.Array.get(getMethod(), i);
149         if (obj != null && !obj.getClass().isArray())
150         {
151           _hashCode += obj.hashCode();
152         }
153       }
154     }
155     if (getSeqs() != null)
156     {
157       _hashCode += getSeqs().hashCode();
158     }
159     __hashCodeCalc = false;
160     return _hashCode;
161   }
162
163 }