Merge branch 'bug/JAL-2691_nomultimermapping' into documentation/JAL-2675_release2102b1
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index 06cdec4..e2f15e1 100755 (executable)
@@ -517,10 +517,9 @@ public class SequenceGroup implements AnnotatedCollectionI
     {
       if (s != null && !sequences.contains(s))
       {
-        List<SequenceI> before = sequences;
         sequences.add(s);
-        changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
-                sequences);
+        changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
+                sequences.size() - 1, sequences.size());
       }
 
       if (recalc)
@@ -645,8 +644,10 @@ public class SequenceGroup implements AnnotatedCollectionI
     conservation.description = "Conservation for group " + getName()
             + " less than " + consPercGaps + "% gaps";
     // preserve width if already set
-    int aWidth = (conservation.annotations != null) ? (endRes < conservation.annotations.length ? conservation.annotations.length
-            : endRes + 1)
+    int aWidth = (conservation.annotations != null)
+            ? (endRes < conservation.annotations.length
+                    ? conservation.annotations.length
+                    : endRes + 1)
             : endRes + 1;
     conservation.annotations = null;
     conservation.annotations = new Annotation[aWidth]; // should be alignment
@@ -666,8 +667,10 @@ public class SequenceGroup implements AnnotatedCollectionI
     consensus.description = "Percent Identity";
     consensusData = cnsns;
     // preserve width if already set
-    int aWidth = (consensus.annotations != null) ? (endRes < consensus.annotations.length ? consensus.annotations.length
-            : endRes + 1)
+    int aWidth = (consensus.annotations != null)
+            ? (endRes < consensus.annotations.length
+                    ? consensus.annotations.length
+                    : endRes + 1)
             : endRes + 1;
     consensus.annotations = null;
     consensus.annotations = new Annotation[aWidth]; // should be alignment width
@@ -713,10 +716,9 @@ public class SequenceGroup implements AnnotatedCollectionI
   {
     synchronized (sequences)
     {
-      List<SequenceI> before = sequences;
       sequences.remove(s);
-      changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
-              sequences);
+      changeSupport.firePropertyChange(SEQ_GROUP_CHANGED,
+              sequences.size() + 1, sequences.size());
 
       if (recalc)
       {
@@ -1336,11 +1338,12 @@ public class SequenceGroup implements AnnotatedCollectionI
     ArrayList<AlignmentAnnotation> aa = new ArrayList<>();
     for (AlignmentAnnotation ann : getAlignmentAnnotation())
     {
-      if ((calcId == null || (ann.getCalcId() != null && ann.getCalcId()
-              .equals(calcId)))
-              && (seq == null || (ann.sequenceRef != null && ann.sequenceRef == seq))
-              && (label == null || (ann.label != null && ann.label
-                      .equals(label))))
+      if ((calcId == null || (ann.getCalcId() != null
+              && ann.getCalcId().equals(calcId)))
+              && (seq == null || (ann.sequenceRef != null
+                      && ann.sequenceRef == seq))
+              && (label == null
+                      || (ann.label != null && ann.label.equals(label))))
       {
         aa.add(ann);
       }
@@ -1376,10 +1379,10 @@ public class SequenceGroup implements AnnotatedCollectionI
   {
     synchronized (sequences)
     {
-      List<SequenceI> before = sequences;
+      int before = sequences.size();
       sequences.clear();
       changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before,
-              sequences);
+              sequences.size());
     }
   }
 
@@ -1467,7 +1470,8 @@ public class SequenceGroup implements AnnotatedCollectionI
   @Override
   public boolean isNucleotide()
   {
-    if (context != null) {
+    if (context != null)
+    {
       return context.isNucleotide();
     }
     return false;