* along with this program; if not, write to the Free Software\r
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
*/\r
-\r
package jalview.datamodel;\r
\r
-public class AlignmentAnnotation\r
-{\r
- public String label;\r
- public String description;\r
- public Annotation [] annotations;\r
- public boolean isGraph = false;\r
- public float graphMin, graphMax;\r
- public int windowLength;\r
-\r
- // Graphical hints and tips\r
- public boolean editable = false;\r
- public boolean hasIcons; //\r
- public boolean hasText;\r
- public boolean visible = true;\r
- public int height=0;\r
-\r
- public AlignmentAnnotation(String label, String description, Annotation [] annotations)\r
- {\r
- // always editable?\r
- editable = true;\r
- this.label = label;\r
- this.description = description;\r
- this.annotations = annotations;\r
- for(int i=0; i<annotations.length; i++)\r
- {\r
- if (annotations[i]!=null &&(\r
- annotations[i].secondaryStructure == 'H' ||\r
- annotations[i].secondaryStructure == 'E'))\r
- hasIcons = true;\r
-\r
- if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)\r
- hasText = true;\r
- }\r
- }\r
-\r
- public AlignmentAnnotation(String label, String description, Annotation [] annotations, float min, float max, int winLength)\r
- {\r
- // graphs are not editable\r
- this.label = label;\r
- this.description = description;\r
- this.annotations = annotations;\r
- isGraph = true;\r
- if(min==max)\r
- {\r
- for(int i=0; i<annotations.length; i++)\r
- {\r
- if(annotations[i]==null)\r
- continue;\r
- if(annotations[i].value>max)\r
- max = annotations[i].value;\r
- if(annotations[i].value<min)\r
- min = annotations[i].value;\r
- }\r
+public class AlignmentAnnotation {\r
+ public String label;\r
+ public String description;\r
+ public Annotation[] annotations;\r
+ public boolean isGraph = false;\r
+ public float graphMin;\r
+ public float graphMax;\r
+ public int windowLength;\r
+\r
+ // Graphical hints and tips\r
+ public boolean editable = false;\r
+ public boolean hasIcons; //\r
+ public boolean hasText;\r
+ public boolean visible = true;\r
+ public int height = 0;\r
+\r
+ public AlignmentAnnotation(String label, String description,\r
+ Annotation[] annotations) {\r
+ // always editable?\r
+ editable = true;\r
+ this.label = label;\r
+ this.description = description;\r
+ this.annotations = annotations;\r
+\r
+ for (int i = 0; i < annotations.length; i++) {\r
+ if ((annotations[i] != null) &&\r
+ ((annotations[i].secondaryStructure == 'H') ||\r
+ (annotations[i].secondaryStructure == 'E'))) {\r
+ hasIcons = true;\r
+ }\r
+\r
+ if ((annotations[i] != null) &&\r
+ (annotations[i].displayCharacter.length() > 0)) {\r
+ hasText = true;\r
+ }\r
+ }\r
}\r
\r
- graphMin = min;\r
- graphMax = max;\r
- windowLength = winLength;\r
- for(int i=0; i<annotations.length; i++)\r
- {\r
- if (annotations[i]!=null &&(\r
- annotations[i].secondaryStructure == 'H' ||\r
- annotations[i].secondaryStructure == 'E'))\r
- hasIcons = true;\r
-\r
- if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)\r
- hasText = true;\r
+ public AlignmentAnnotation(String label, String description,\r
+ Annotation[] annotations, float min, float max, int winLength) {\r
+ // graphs are not editable\r
+ this.label = label;\r
+ this.description = description;\r
+ this.annotations = annotations;\r
+ isGraph = true;\r
+\r
+ if (min == max) {\r
+ for (int i = 0; i < annotations.length; i++) {\r
+ if (annotations[i] == null) {\r
+ continue;\r
+ }\r
+\r
+ if (annotations[i].value > max) {\r
+ max = annotations[i].value;\r
+ }\r
+\r
+ if (annotations[i].value < min) {\r
+ min = annotations[i].value;\r
+ }\r
+ }\r
+ }\r
+\r
+ graphMin = min;\r
+ graphMax = max;\r
+ windowLength = winLength;\r
+\r
+ for (int i = 0; i < annotations.length; i++) {\r
+ if ((annotations[i] != null) &&\r
+ ((annotations[i].secondaryStructure == 'H') ||\r
+ (annotations[i].secondaryStructure == 'E'))) {\r
+ hasIcons = true;\r
+ }\r
+\r
+ if ((annotations[i] != null) &&\r
+ (annotations[i].displayCharacter.length() > 0)) {\r
+ hasText = true;\r
+ }\r
+ }\r
}\r
- }\r
-\r
- public String toString()\r
- {\r
- StringBuffer buffer = new StringBuffer();\r
- for(int i=0; i<annotations.length; i++)\r
- {\r
- if(annotations[i]!=null)\r
- {\r
- if(isGraph)\r
- buffer.append(annotations[i].value);\r
- else if(hasIcons)\r
- buffer.append(annotations[i].secondaryStructure);\r
- else\r
- buffer.append(annotations[i].displayCharacter);\r
-\r
- }\r
- buffer.append(", ");\r
- }\r
- if(label.equals("Consensus"))\r
- {\r
- buffer.append("\n");\r
- for (int i = 0; i < annotations.length; i++)\r
- {\r
- if (annotations[i] != null)\r
- buffer.append(annotations[i].description);\r
- buffer.append(", ");\r
- }\r
- }\r
- return buffer.toString();\r
- }\r
\r
+ public String toString() {\r
+ StringBuffer buffer = new StringBuffer();\r
+\r
+ for (int i = 0; i < annotations.length; i++) {\r
+ if (annotations[i] != null) {\r
+ if (isGraph) {\r
+ buffer.append(annotations[i].value);\r
+ } else if (hasIcons) {\r
+ buffer.append(annotations[i].secondaryStructure);\r
+ } else {\r
+ buffer.append(annotations[i].displayCharacter);\r
+ }\r
+ }\r
+\r
+ buffer.append(", ");\r
+ }\r
+\r
+ if (label.equals("Consensus")) {\r
+ buffer.append("\n");\r
+\r
+ for (int i = 0; i < annotations.length; i++) {\r
+ if (annotations[i] != null) {\r
+ buffer.append(annotations[i].description);\r
+ }\r
+\r
+ buffer.append(", ");\r
+ }\r
+ }\r
+\r
+ return buffer.toString();\r
+ }\r
}\r