X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=c4098e26594753f3caa175ca4ae6922e41e0856f;hb=4f77328104498504339216829abf5ea87e2791ec;hp=98510e39524e0b415780f424ca6f323ba53ca583;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 98510e3..c4098e2 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -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 temp = new ArrayList<>(); - /* * (non-Javadoc) * @@ -411,15 +413,11 @@ public class Alignment implements AlignmentI @Override public SequenceGroup[] findAllGroups(SequenceI s) { + ArrayList 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(); - // } - } - }