JAL-2920 simplified logic and added corner cases for missing attributes (probably...
[jalview.git] / src / jalview / datamodel / xdb / uniprot / UniprotFeature.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 jalview.datamodel.xdb.uniprot;
22
23 /**
24  * A data model class for binding from Uniprot XML via uniprot_mapping.xml
25  */
26 public class UniprotFeature
27 {
28   private String type;
29
30   private String description = null;
31
32   private String original = null;
33
34   private String variation = null;
35
36   private String status;
37
38   private int begin;
39
40   private int end;
41
42   public String getType()
43   {
44     return type;
45   }
46
47   public void setType(String t)
48   {
49     this.type = t;
50   }
51
52   public String getDescription()
53   {
54     if (description == null && variation == null && original == null)
55     {
56       return null;
57     }
58     return (description == null ? "" : description)
59             + (variation != null
60                     ? (description != null ? " " : "") + "Variation: '"
61                             + variation + "'"
62                     : "")
63             + (original != null
64                     ? ((description != null || variation != null) ? " "
65                             : "") + "Original: '" + original + "'"
66                     : "");
67   }
68
69   public void setDescription(String d)
70   {
71     this.description = d;
72   }
73
74   public String getStatus()
75   {
76     return status;
77   }
78
79   public void setStatus(String s)
80   {
81     this.status = s;
82   }
83
84   public int getBegin()
85   {
86     return begin;
87   }
88
89   public void setBegin(int b)
90   {
91     this.begin = b;
92   }
93
94   public int getEnd()
95   {
96     return end;
97   }
98
99   public void setEnd(int e)
100   {
101     this.end = e;
102   }
103
104   public int getPosition()
105   {
106     return begin;
107   }
108
109   public void setPosition(int p)
110   {
111     this.begin = p;
112     this.end = p;
113   }
114
115   public String getOriginal()
116   {
117     return original;
118   }
119
120   public void setOriginal(String original)
121   {
122     this.original = original;
123   }
124
125   public String getVariation()
126   {
127     return variation;
128   }
129
130   public void setVariation(String variant)
131   {
132     this.variation = variant;
133   }
134 }