1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import java.awt.Color; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
@author |
29 |
|
@version |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 70 (70) |
Complexity: 18 |
Complexity Density: 0.39 |
|
31 |
|
public class Annotation |
32 |
|
{ |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
public static final Annotation EMPTY_ANNOTATION = new Annotation("", "", |
37 |
|
' ', 0f); |
38 |
|
|
39 |
|
|
40 |
|
public String displayCharacter = ""; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
public String description = ""; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
public char secondaryStructure = ' '; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
public float value; |
58 |
|
|
59 |
|
|
60 |
|
public Color colour; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
@param |
66 |
|
|
67 |
|
@param |
68 |
|
|
69 |
|
@param |
70 |
|
|
71 |
|
@param |
72 |
|
|
73 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
74 |
0 |
public Annotation(String displayChar, String desc, char ss, float val)... |
75 |
|
{ |
76 |
0 |
displayCharacter = displayChar; |
77 |
0 |
description = desc; |
78 |
0 |
secondaryStructure = ss; |
79 |
0 |
value = val; |
80 |
|
|
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
|
88 |
|
@param |
89 |
|
|
90 |
|
@param |
91 |
|
|
92 |
|
@param |
93 |
|
|
94 |
|
@param |
95 |
|
|
96 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
97 |
0 |
public Annotation(String displayChar, String desc, char ss, float val,... |
98 |
|
Color colour) |
99 |
|
{ |
100 |
0 |
this(displayChar, desc, ss, val); |
101 |
0 |
this.colour = colour; |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
@param |
109 |
|
|
110 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
111 |
0 |
public Annotation(Annotation that)... |
112 |
|
{ |
113 |
0 |
if (that == null || this == that) |
114 |
|
{ |
115 |
0 |
return; |
116 |
|
} |
117 |
0 |
if (that.displayCharacter != null) |
118 |
|
{ |
119 |
0 |
displayCharacter = new String(that.displayCharacter); |
120 |
|
} |
121 |
0 |
if (that.description != null) |
122 |
|
{ |
123 |
0 |
description = new String(that.description); |
124 |
|
} |
125 |
0 |
secondaryStructure = that.secondaryStructure; |
126 |
0 |
value = that.value; |
127 |
0 |
colour = that.colour; |
128 |
|
|
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
@param |
135 |
|
|
136 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
137 |
0 |
public Annotation(float val)... |
138 |
|
{ |
139 |
0 |
this(null, null, ' ', val, null); |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 9 |
Complexity Density: 0.31 |
|
151 |
0 |
@Override... |
152 |
|
public String toString() |
153 |
|
{ |
154 |
0 |
StringBuffer sb = new StringBuffer(); |
155 |
0 |
if (displayCharacter != null) |
156 |
|
{ |
157 |
0 |
sb.append("\'"); |
158 |
0 |
sb.append(displayCharacter); |
159 |
0 |
sb.append("\'"); |
160 |
|
} |
161 |
|
{ |
162 |
0 |
sb.append(","); |
163 |
|
} |
164 |
0 |
if (secondaryStructure != 0 |
165 |
|
&& !("" + displayCharacter).equals("" + secondaryStructure)) |
166 |
|
{ |
167 |
0 |
sb.append("\'"); |
168 |
0 |
sb.append(secondaryStructure); |
169 |
0 |
sb.append("\'"); |
170 |
|
} |
171 |
|
{ |
172 |
0 |
sb.append(","); |
173 |
|
} |
174 |
0 |
if (description != null && description.length() > 0) |
175 |
|
{ |
176 |
0 |
sb.append("\""); |
177 |
0 |
sb.append(description); |
178 |
0 |
sb.append("\""); |
179 |
|
} |
180 |
|
{ |
181 |
0 |
sb.append(","); |
182 |
|
} |
183 |
0 |
if (!Float.isNaN(value)) |
184 |
|
{ |
185 |
0 |
sb.append(value); |
186 |
|
} |
187 |
0 |
if (colour != null) |
188 |
|
{ |
189 |
0 |
if (sb.length() > 0) |
190 |
|
{ |
191 |
0 |
sb.append(","); |
192 |
|
} |
193 |
0 |
sb.append("["); |
194 |
0 |
sb.append(colour.getRed()); |
195 |
0 |
sb.append(","); |
196 |
0 |
sb.append(colour.getGreen()); |
197 |
0 |
sb.append(","); |
198 |
0 |
sb.append(colour.getBlue()); |
199 |
0 |
sb.append("]"); |
200 |
|
} |
201 |
0 |
return sb.toString(); |
202 |
|
} |
203 |
|
|
204 |
|
|
205 |
|
@return |
206 |
|
|
207 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
208 |
0 |
public boolean isWhitespace()... |
209 |
|
{ |
210 |
0 |
return ((value == 0f) |
211 |
|
&& ((description == null) || (description.trim().length() == 0)) |
212 |
|
&& ((displayCharacter == null) |
213 |
|
|| (displayCharacter.trim().length() == 0) |
214 |
|
|| (displayCharacter.equals(" ."))) |
215 |
|
|
216 |
|
|
217 |
|
&& (secondaryStructure == '\0' || (secondaryStructure == ' ')) |
218 |
|
&& colour == null); |
219 |
|
} |
220 |
|
} |