AlignmentAnnotation: added annotation score attribute and allowed for annotation...
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
index 16f8fb8..3ad05ea 100755 (executable)
@@ -54,8 +54,15 @@ public class AlignmentAnnotation
   /** DOCUMENT ME!! */
   public float graphMax;
 
+  /**
+   * Score associated with label and description.
+   */
   public float score;
-
+  /**
+   * flag indicating if annotation has a score.
+   */
+  public boolean hasScore=false;
+  
   public GraphLine threshold;
 
   // Graphical hints and tips
@@ -216,6 +223,11 @@ public class AlignmentAnnotation
    * if appropriate.
    */
   private void validateRangeAndDisplay() {
+    if (annotations==null)
+    {
+      visible=false; // try to prevent renderer from displaying.
+      return; // this is a non-annotation row annotation - ie a sequence score.
+    }
     int graphType = graph;
     float min = graphMin;
     float max = graphMax;
@@ -459,7 +471,10 @@ public class AlignmentAnnotation
     {
       return;
     }
-
+    if (annotations==null)
+    {
+      return;
+    }
     sequenceMapping = new java.util.Hashtable();
 
     sequenceRef = seqRef;
@@ -489,6 +504,11 @@ public class AlignmentAnnotation
     if (sequenceRef==null)
       return;
 
+    if (annotations==null)
+    {
+      return;
+    }
+
     int a = 0, aSize = sequenceRef.getLength();
 
     if (aSize == 0)
@@ -580,4 +600,28 @@ public class AlignmentAnnotation
       sequenceRef = null;
     }
   }
+
+  /**
+   * @return the score
+   */
+  public float getScore()
+  {
+    return score;
+  }
+
+  /**
+   * @param score the score to set
+   */
+  public void setScore(float score)
+  {
+    this.score = score;
+  }
+  /**
+   * 
+   * @return true if annotation has an associated score
+   */
+  public boolean hasScore()
+  {
+    return hasScore;
+  }
 }