X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=9cfdff6dbadd957baeb30925cdecc56a29523dfc;hb=3f9ed3a1f79978b51fbdd98608bc3558278d5569;hp=35297b56bce55cbf0a93f2fbd00c22d17b95d05f;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 35297b5..9cfdff6 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -18,63 +18,121 @@ */ package jalview.datamodel; -public class AlignmentAnnotation { + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class AlignmentAnnotation +{ + /** DOCUMENT ME!! */ public String label; + + /** DOCUMENT ME!! */ public String description; + + /** DOCUMENT ME!! */ public Annotation[] annotations; + + /** DOCUMENT ME!! */ public boolean isGraph = false; + + /** DOCUMENT ME!! */ public float graphMin; + + /** DOCUMENT ME!! */ public float graphMax; + + /** DOCUMENT ME!! */ public int windowLength; // Graphical hints and tips + + /** DOCUMENT ME!! */ public boolean editable = false; + + /** DOCUMENT ME!! */ public boolean hasIcons; // + + /** DOCUMENT ME!! */ public boolean hasText; + + /** DOCUMENT ME!! */ public boolean visible = true; + + /** DOCUMENT ME!! */ public int height = 0; + /** + * Creates a new AlignmentAnnotation object. + * + * @param label DOCUMENT ME! + * @param description DOCUMENT ME! + * @param annotations DOCUMENT ME! + */ public AlignmentAnnotation(String label, String description, - Annotation[] annotations) { + Annotation[] annotations) + { // always editable? editable = true; this.label = label; this.description = description; this.annotations = annotations; - for (int i = 0; i < annotations.length; i++) { + for (int i = 0; i < annotations.length; i++) + { if ((annotations[i] != null) && ((annotations[i].secondaryStructure == 'H') || - (annotations[i].secondaryStructure == 'E'))) { + (annotations[i].secondaryStructure == 'E'))) + { hasIcons = true; } if ((annotations[i] != null) && - (annotations[i].displayCharacter.length() > 0)) { + (annotations[i].displayCharacter.length() > 0)) + { hasText = true; } } } + /** + * Creates a new AlignmentAnnotation object. + * + * @param label DOCUMENT ME! + * @param description DOCUMENT ME! + * @param annotations DOCUMENT ME! + * @param min DOCUMENT ME! + * @param max DOCUMENT ME! + * @param winLength DOCUMENT ME! + */ public AlignmentAnnotation(String label, String description, - Annotation[] annotations, float min, float max, int winLength) { + Annotation[] annotations, float min, float max, int winLength) + { // graphs are not editable this.label = label; this.description = description; this.annotations = annotations; isGraph = true; - if (min == max) { - for (int i = 0; i < annotations.length; i++) { - if (annotations[i] == null) { + if (min == max) + { + for (int i = 0; i < annotations.length; i++) + { + if (annotations[i] == null) + { continue; } - if (annotations[i].value > max) { + if (annotations[i].value > max) + { max = annotations[i].value; } - if (annotations[i].value < min) { + if (annotations[i].value < min) + { min = annotations[i].value; } } @@ -84,30 +142,46 @@ public class AlignmentAnnotation { graphMax = max; windowLength = winLength; - for (int i = 0; i < annotations.length; i++) { + for (int i = 0; i < annotations.length; i++) + { if ((annotations[i] != null) && ((annotations[i].secondaryStructure == 'H') || - (annotations[i].secondaryStructure == 'E'))) { + (annotations[i].secondaryStructure == 'E'))) + { hasIcons = true; } if ((annotations[i] != null) && - (annotations[i].displayCharacter.length() > 0)) { + (annotations[i].displayCharacter.length() > 0)) + { hasText = true; } } } - public String toString() { + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String toString() + { StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < annotations.length; i++) { - if (annotations[i] != null) { - if (isGraph) { + for (int i = 0; i < annotations.length; i++) + { + if (annotations[i] != null) + { + if (isGraph) + { buffer.append(annotations[i].value); - } else if (hasIcons) { + } + else if (hasIcons) + { buffer.append(annotations[i].secondaryStructure); - } else { + } + else + { buffer.append(annotations[i].displayCharacter); } } @@ -115,11 +189,14 @@ public class AlignmentAnnotation { buffer.append(", "); } - if (label.equals("Consensus")) { + if (label.equals("Consensus")) + { buffer.append("\n"); - for (int i = 0; i < annotations.length; i++) { - if (annotations[i] != null) { + for (int i = 0; i < annotations.length; i++) + { + if (annotations[i] != null) + { buffer.append(annotations[i].description); }