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