merge from 2_4_Release branch
[jalview.git] / src / vamsas / objects / simple / Sequence.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package vamsas.objects.simple;
20
21 public class Sequence implements java.io.Serializable
22 {
23   private java.lang.String id;
24
25   private java.lang.String seq;
26
27   public Sequence()
28   {
29   }
30
31   public Sequence(java.lang.String id, java.lang.String seq)
32   {
33     this.id = id;
34     this.seq = seq;
35   }
36
37   /**
38    * Gets the id value for this Sequence.
39    * 
40    * @return id
41    */
42   public java.lang.String getId()
43   {
44     return id;
45   }
46
47   /**
48    * Sets the id value for this Sequence.
49    * 
50    * @param id
51    */
52   public void setId(java.lang.String id)
53   {
54     this.id = id;
55   }
56
57   /**
58    * Gets the seq value for this Sequence.
59    * 
60    * @return seq
61    */
62   public java.lang.String getSeq()
63   {
64     return seq;
65   }
66
67   /**
68    * Sets the seq value for this Sequence.
69    * 
70    * @param seq
71    */
72   public void setSeq(java.lang.String seq)
73   {
74     this.seq = seq;
75   }
76
77   private java.lang.Object __equalsCalc = null;
78
79   public synchronized boolean equals(java.lang.Object obj)
80   {
81     if (!(obj instanceof Sequence))
82       return false;
83     Sequence other = (Sequence) obj;
84     if (obj == null)
85       return false;
86     if (this == obj)
87       return true;
88     if (__equalsCalc != null)
89     {
90       return (__equalsCalc == obj);
91     }
92     __equalsCalc = obj;
93     boolean _equals;
94     _equals = true
95             && ((this.id == null && other.getId() == null) || (this.id != null && this.id
96                     .equals(other.getId())))
97             && ((this.seq == null && other.getSeq() == null) || (this.seq != null && this.seq
98                     .equals(other.getSeq())));
99     __equalsCalc = null;
100     return _equals;
101   }
102
103   private boolean __hashCodeCalc = false;
104
105   public synchronized int hashCode()
106   {
107     if (__hashCodeCalc)
108     {
109       return 0;
110     }
111     __hashCodeCalc = true;
112     int _hashCode = 1;
113     if (getId() != null)
114     {
115       _hashCode += getId().hashCode();
116     }
117     if (getSeq() != null)
118     {
119       _hashCode += getSeq().hashCode();
120     }
121     __hashCodeCalc = false;
122     return _hashCode;
123   }
124
125 }