JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / datamodel / Alignment.java
index 98510e3..c4098e2 100755 (executable)
@@ -47,7 +47,7 @@ import java.util.Vector;
  * @author JimP
  * 
  */
-public class Alignment implements AlignmentI
+public class Alignment implements AlignmentI, AutoCloseable
 {
   private Alignment dataset;
 
@@ -125,7 +125,8 @@ public class Alignment implements AlignmentI
   /**
    * Make a new alignment from an array of SeqCigars
    * 
-   * @param alseqs
+   * @param seqs
+   *          SeqCigar[]
    */
   public Alignment(SeqCigar[] alseqs)
   {
@@ -302,15 +303,20 @@ public class Alignment implements AlignmentI
   }
 
   @Override
-  public void finalize() throws Throwable
+  public void close()
   {
     if (getDataset() != null)
     {
-      getDataset().removeAlignmentRef();
+      try
+      {
+        getDataset().removeAlignmentRef();
+      } catch (Throwable e)
+      {
+        e.printStackTrace();
+      }
     }
 
     nullReferences();
-    super.finalize();
   }
 
   /**
@@ -398,10 +404,6 @@ public class Alignment implements AlignmentI
     return null;
   }
 
-  private static final SequenceGroup[] noGroups = new SequenceGroup[0];
-
-  private ArrayList<SequenceGroup> temp = new ArrayList<>();
-
   /*
    * (non-Javadoc)
    * 
@@ -411,15 +413,11 @@ public class Alignment implements AlignmentI
   @Override
   public SequenceGroup[] findAllGroups(SequenceI s)
   {
+    ArrayList<SequenceGroup> temp = new ArrayList<>();
 
     synchronized (groups)
     {
       int gSize = groups.size();
-      if (gSize == 0)
-      {
-        return noGroups;
-      }
-      temp.clear();
       for (int i = 0; i < gSize; i++)
       {
         SequenceGroup sg = groups.get(i);
@@ -2034,17 +2032,4 @@ public class Alignment implements AlignmentI
     }
   }
 
-  @Override
-  public void resetColors()
-  {
-    for (int i = getHeight(); --i >= 0;)
-    {
-      sequences.get(i).resetColors();
-    }
-    // if (dataset != null)
-    // {
-    // dataset.resetColors();
-    // }
-  }
-
 }