d72419f56282b5006fa5e94bfff1feb3dd041f34
[jalview.git] / src / vamsas / objects / simple / SequenceSet.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
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   public synchronized boolean equals(java.lang.Object obj)
59   {
60     if (!(obj instanceof SequenceSet))
61       return false;
62     SequenceSet other = (SequenceSet) obj;
63     if (obj == null)
64       return false;
65     if (this == obj)
66       return true;
67     if (__equalsCalc != null)
68     {
69       return (__equalsCalc == obj);
70     }
71     __equalsCalc = obj;
72     boolean _equals;
73     _equals = true && ((this.seqs == null && other.getSeqs() == null) || (this.seqs != null && java.util.Arrays
74             .equals(this.seqs, other.getSeqs())));
75     __equalsCalc = null;
76     return _equals;
77   }
78
79   private boolean __hashCodeCalc = false;
80
81   public synchronized int hashCode()
82   {
83     if (__hashCodeCalc)
84     {
85       return 0;
86     }
87     __hashCodeCalc = true;
88     int _hashCode = 1;
89     if (getSeqs() != null)
90     {
91       for (int i = 0; i < java.lang.reflect.Array.getLength(getSeqs()); i++)
92       {
93         java.lang.Object obj = java.lang.reflect.Array.get(getSeqs(), i);
94         if (obj != null && !obj.getClass().isArray())
95         {
96           _hashCode += obj.hashCode();
97         }
98       }
99     }
100     __hashCodeCalc = false;
101     return _hashCode;
102   }
103
104 }