return true;
}
-
- /**
- * DOCUMENT ME!
- *
- * @param aa DOCUMENT ME!
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.AlignmentAnnotation)
*/
public void deleteAnnotation(AlignmentAnnotation aa)
{
- if(aa.sequenceRef!=null)
- aa.sequenceRef.removeAlignmentAnnotation(aa);
-
int aSize = 1;
if (annotations != null)
AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];
+ boolean swap=false;
int tIndex = 0;
- for (int i = 0; i < aSize; i++)
+ for (int i = 0; tIndex<temp.length && i < aSize; i++)
{
if (annotations[i] == aa)
{
+ swap=true;
continue;
}
tIndex++;
}
- annotations = temp;
+ if (swap)
+ {
+ annotations = temp;
+ if(aa.sequenceRef!=null)
+ aa.sequenceRef.removeAlignmentAnnotation(aa);
+ }
}
/**
public void setAnnotationIndex(AlignmentAnnotation aa, int index);
/**
- * Deletes a specific AlignmentAnnotation from the alignment.
- *
+ * Deletes a specific AlignmentAnnotation from the alignment,
+ * and removes its reference from any SequenceI object's annotation
+ * if and only if aa is contained within the alignment's annotation
+ * vector.
+ *
* @param aa the annotation to delete
*/
public void deleteAnnotation(AlignmentAnnotation aa);