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