d5a269b3298eedf52935720366336cb8da9cae9d
[jalview.git] / src / vamsas / objects / simple / SequenceSet.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 SequenceSet implements java.io.Serializable
24 {
25   private vamsas.objects.simple.Sequence[] seqs;
26
27   public SequenceSet()
28   {
29   }
30
31   public SequenceSet(vamsas.objects.simple.Sequence[] seqs)
32   {
33     this.seqs = seqs;
34   }
35
36   /**
37    * Gets the seqs value for this SequenceSet.
38    * 
39    * @return seqs
40    */
41   public vamsas.objects.simple.Sequence[] getSeqs()
42   {
43     return seqs;
44   }
45
46   /**
47    * Sets the seqs value for this SequenceSet.
48    * 
49    * @param seqs
50    */
51   public void setSeqs(vamsas.objects.simple.Sequence[] seqs)
52   {
53     this.seqs = seqs;
54   }
55
56   private java.lang.Object __equalsCalc = null;
57
58   @Override
59   public synchronized boolean equals(java.lang.Object obj)
60   {
61     if (obj == null)
62     {
63       return false;
64     }
65     if (!(obj instanceof SequenceSet))
66     {
67       return false;
68     }
69     SequenceSet other = (SequenceSet) obj;
70     if (this == obj)
71     {
72       return true;
73     }
74     if (__equalsCalc != null)
75     {
76       return (__equalsCalc == obj);
77     }
78     __equalsCalc = obj;
79     boolean _equals;
80     _equals = true && ((this.seqs == null && other.getSeqs() == null) || (this.seqs != null && java.util.Arrays
81             .equals(this.seqs, other.getSeqs())));
82     __equalsCalc = null;
83     return _equals;
84   }
85
86   private boolean __hashCodeCalc = false;
87
88   @Override
89   public synchronized int hashCode()
90   {
91     if (__hashCodeCalc)
92     {
93       return 0;
94     }
95     __hashCodeCalc = true;
96     int _hashCode = 1;
97     if (getSeqs() != null)
98     {
99       for (int i = 0; i < java.lang.reflect.Array.getLength(getSeqs()); i++)
100       {
101         java.lang.Object obj = java.lang.reflect.Array.get(getSeqs(), i);
102         if (obj != null && !obj.getClass().isArray())
103         {
104           _hashCode += obj.hashCode();
105         }
106       }
107     }
108     __hashCodeCalc = false;
109     return _hashCode;
110   }
111
112 }