X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignmentSorter.java;h=8634db68d2bedf572eaa2d94c3ffeece92a33e9e;hb=970956e40635fd5a86d46e399532abda64ccdf92;hp=427db84270b79c1957490d7d2d046cee34590deb;hpb=5721b73c6d5de84b21a989a8734e4c161f5dc630;p=jalview.git diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 427db84..8634db6 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -22,6 +22,8 @@ package jalview.analysis; import jalview.analysis.scoremodels.PIDModel; import jalview.analysis.scoremodels.SimilarityParams; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentOrder; @@ -29,7 +31,6 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.datamodel.SequenceNode; -import jalview.util.Platform; import jalview.util.QuickSort; import java.util.ArrayList; @@ -52,9 +53,20 @@ import java.util.List; * from the first tobesorted position in the alignment. e.g. (a,tb2,b,tb1,c,tb3 * becomes a,tb1,tb2,tb3,b,c) */ -public class AlignmentSorter +public class AlignmentSorter implements ApplicationSingletonI { + private AlignmentSorter() + { + // private singleton + } + + private static AlignmentSorter getInstance() + { + return (AlignmentSorter) ApplicationSingletonProvider + .getInstance(AlignmentSorter.class); + } + /** * types of feature ordering: Sort by score : average score - or total score - * over all features in region Sort by feature label text: (or if null - @@ -67,43 +79,6 @@ public class AlignmentSorter public static final String FEATURE_DENSITY = "density"; - static AlignmentSorter instance; - - public static AlignmentSorter getInstance() - { - - // BH 2019.05.08 need to isolate static fields in JavaScript - - AlignmentSorter i = instance; - @SuppressWarnings("unused") - ThreadGroup g = null; - if (Platform.isJS()) - { - g = Thread.currentThread().getThreadGroup(); - /** - * @j2sNative i = g._jalviewAlignmentSorterInstance; - * - */ - } - if (i == null) - { - i = new AlignmentSorter(); - - if (Platform.isJS()) - { - /** - * @j2sNative g._jalviewAlignmentSorterInstance = i; - * - */ - } - else - { - instance = i; - } - } - return i; - } - /* * todo: refactor searches to follow a basic pattern: (search property, last * search state, current sort direction)