Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / jalview / analysis / AnnotationSorter.js
index a942585..ffaa451 100644 (file)
-Clazz.declarePackage ("jalview.analysis");\r
-Clazz.load (["java.lang.Enum", "java.util.HashMap"], "jalview.analysis.AnnotationSorter", ["jalview.analysis.AlignmentUtils", "java.lang.UnsupportedOperationException", "java.util.Arrays"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.alignment = null;\r
-this.showAutocalcAbove = false;\r
-this.sequenceIndices = null;\r
-this.bySequenceAndLabel = null;\r
-this.byLabelAndSequence = null;\r
-this.noSort = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.analysis, "AnnotationSorter");\r
-Clazz.prepareFields (c$, function () {\r
-this.sequenceIndices =  new java.util.HashMap ();\r
-this.bySequenceAndLabel = ((Clazz.isClassDefined ("jalview.analysis.AnnotationSorter$1") ? 0 : jalview.analysis.AnnotationSorter.$AnnotationSorter$1$ ()), Clazz.innerTypeInstance (jalview.analysis.AnnotationSorter$1, this, null));\r
-this.byLabelAndSequence = ((Clazz.isClassDefined ("jalview.analysis.AnnotationSorter$2") ? 0 : jalview.analysis.AnnotationSorter.$AnnotationSorter$2$ ()), Clazz.innerTypeInstance (jalview.analysis.AnnotationSorter$2, this, null));\r
-this.noSort = ((Clazz.isClassDefined ("jalview.analysis.AnnotationSorter$3") ? 0 : jalview.analysis.AnnotationSorter.$AnnotationSorter$3$ ()), Clazz.innerTypeInstance (jalview.analysis.AnnotationSorter$3, this, null));\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (alignmentI, showAutocalculatedAbove) {\r
-this.alignment = alignmentI;\r
-this.showAutocalcAbove = showAutocalculatedAbove;\r
-}, "jalview.datamodel.AlignmentI,~B");\r
-Clazz.defineMethod (c$, "sort", \r
-function (alignmentAnnotations, order) {\r
-if (alignmentAnnotations == null) {\r
-return;\r
-}this.saveSequenceIndices (alignmentAnnotations);\r
-var comparator = this.getComparator (order);\r
-if (alignmentAnnotations != null) {\r
-{\r
-java.util.Arrays.sort (alignmentAnnotations, comparator);\r
-}}}, "~A,jalview.analysis.AnnotationSorter.SequenceAnnotationOrder");\r
-Clazz.defineMethod (c$, "saveSequenceIndices", \r
- function (alignmentAnnotations) {\r
-this.sequenceIndices.clear ();\r
-for (var ann, $ann = 0, $$ann = alignmentAnnotations; $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) {\r
-var seq = ann.sequenceRef;\r
-if (seq != null) {\r
-var index = jalview.analysis.AlignmentUtils.getSequenceIndex (this.alignment, seq);\r
-this.sequenceIndices.put (seq, new Integer (index));\r
-}}\r
-}, "~A");\r
-Clazz.defineMethod (c$, "getComparator", \r
- function (order) {\r
-if (order == null) {\r
-return this.noSort;\r
-}switch (order) {\r
-case jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.NONE:\r
-return this.noSort;\r
-case jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.SEQUENCE_AND_LABEL:\r
-return this.bySequenceAndLabel;\r
-case jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.LABEL_AND_SEQUENCE:\r
-return this.byLabelAndSequence;\r
-default:\r
-throw  new UnsupportedOperationException (order.toString ());\r
-}\r
-}, "jalview.analysis.AnnotationSorter.SequenceAnnotationOrder");\r
-Clazz.defineMethod (c$, "compareLabels", \r
- function (o1, o2) {\r
-if (o1 == null || o2 == null) {\r
-return 0;\r
-}var label1 = o1.label;\r
-var label2 = o2.label;\r
-if (label1 == null && label2 == null) {\r
-return 0;\r
-}if (label1 == null) {\r
-return -1;\r
-}if (label2 == null) {\r
-return 1;\r
-}return label1.toUpperCase ().compareTo (label2.toUpperCase ());\r
-}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");\r
-Clazz.defineMethod (c$, "compareSequences", \r
- function (o1, o2) {\r
-var seq1 = o1.sequenceRef;\r
-var seq2 = o2.sequenceRef;\r
-if (seq1 == null && seq2 == null) {\r
-return 0;\r
-}if (seq1 == null) {\r
-return this.showAutocalcAbove ? -1 : 1;\r
-}if (seq2 == null) {\r
-return this.showAutocalcAbove ? 1 : -1;\r
-}var index1 = (this.sequenceIndices.get (seq1)).intValue ();\r
-var index2 = (this.sequenceIndices.get (seq2)).intValue ();\r
-if (index1 == index2) {\r
-return 0;\r
-}if (index1 == -1) {\r
-return -1;\r
-}if (index2 == -1) {\r
-return 1;\r
-}return Integer.compare (index1, index2);\r
-}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");\r
-c$.$AnnotationSorter$1$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.declareAnonymous (jalview.analysis, "AnnotationSorter$1", null, java.util.Comparator);\r
-Clazz.overrideMethod (c$, "compare", \r
-function (o1, o2) {\r
-if (o1 == null && o2 == null) {\r
-return 0;\r
-}if (o1 == null) {\r
-return -1;\r
-}if (o2 == null) {\r
-return 1;\r
-}if (o1.sequenceRef == null && o2.sequenceRef == null) {\r
-return 0;\r
-}var sequenceOrder = this.b$["jalview.analysis.AnnotationSorter"].compareSequences (o1, o2);\r
-return sequenceOrder == 0 ? this.b$["jalview.analysis.AnnotationSorter"].compareLabels (o1, o2) : sequenceOrder;\r
-}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.$AnnotationSorter$2$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.declareAnonymous (jalview.analysis, "AnnotationSorter$2", null, java.util.Comparator);\r
-Clazz.overrideMethod (c$, "compare", \r
-function (o1, o2) {\r
-if (o1 == null && o2 == null) {\r
-return 0;\r
-}if (o1 == null) {\r
-return -1;\r
-}if (o2 == null) {\r
-return 1;\r
-}if (o1.sequenceRef == null && o2.sequenceRef == null) {\r
-return 0;\r
-}if (o1.sequenceRef == null) {\r
-return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? -1 : 1;\r
-}if (o2.sequenceRef == null) {\r
-return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? 1 : -1;\r
-}var labelOrder = this.b$["jalview.analysis.AnnotationSorter"].compareLabels (o1, o2);\r
-return labelOrder == 0 ? this.b$["jalview.analysis.AnnotationSorter"].compareSequences (o1, o2) : labelOrder;\r
-}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.$AnnotationSorter$3$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.declareAnonymous (jalview.analysis, "AnnotationSorter$3", null, java.util.Comparator);\r
-Clazz.overrideMethod (c$, "compare", \r
-function (o1, o2) {\r
-if (o1 != null && o2 != null) {\r
-if (o1.sequenceRef == null && o2.sequenceRef != null) {\r
-return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? -1 : 1;\r
-}if (o1.sequenceRef != null && o2.sequenceRef == null) {\r
-return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? 1 : -1;\r
-}}return 0;\r
-}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");\r
-c$ = Clazz.p0p ();\r
-};\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.description = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.analysis.AnnotationSorter, "SequenceAnnotationOrder", Enum);\r
-Clazz.makeConstructor (c$, \r
- function (a) {\r
-this.description = a;\r
-}, "~S");\r
-Clazz.overrideMethod (c$, "toString", \r
-function () {\r
-return this.description;\r
-});\r
-c$.forDescription = Clazz.defineMethod (c$, "forDescription", \r
-function (a) {\r
-for (var order, $order = 0, $$order = jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.values (); $order < $$order.length && ((order = $$order[$order]) || true); $order++) {\r
-if (order.toString ().equals (a)) {\r
-return order;\r
-}}\r
-return null;\r
-}, "~S");\r
-Clazz.defineEnumConstant (c$, "SEQUENCE_AND_LABEL", 0, ["Sequence"]);\r
-Clazz.defineEnumConstant (c$, "LABEL_AND_SEQUENCE", 1, ["Label"]);\r
-Clazz.defineEnumConstant (c$, "NONE", 2, ["No sort"]);\r
-c$ = Clazz.p0p ();\r
-});\r
+Clazz.declarePackage ("jalview.analysis");
+Clazz.load (["java.lang.Enum", "java.util.HashMap"], "jalview.analysis.AnnotationSorter", ["jalview.analysis.AlignmentUtils", "java.lang.UnsupportedOperationException", "java.util.Arrays"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.alignment = null;
+this.showAutocalcAbove = false;
+this.sequenceIndices = null;
+this.bySequenceAndLabel = null;
+this.byLabelAndSequence = null;
+this.noSort = null;
+Clazz.instantialize (this, arguments);
+}, jalview.analysis, "AnnotationSorter");
+Clazz.prepareFields (c$, function () {
+this.sequenceIndices =  new java.util.HashMap ();
+this.bySequenceAndLabel = ((Clazz.isClassDefined ("jalview.analysis.AnnotationSorter$1") ? 0 : jalview.analysis.AnnotationSorter.$AnnotationSorter$1$ ()), Clazz.innerTypeInstance (jalview.analysis.AnnotationSorter$1, this, null));
+this.byLabelAndSequence = ((Clazz.isClassDefined ("jalview.analysis.AnnotationSorter$2") ? 0 : jalview.analysis.AnnotationSorter.$AnnotationSorter$2$ ()), Clazz.innerTypeInstance (jalview.analysis.AnnotationSorter$2, this, null));
+this.noSort = ((Clazz.isClassDefined ("jalview.analysis.AnnotationSorter$3") ? 0 : jalview.analysis.AnnotationSorter.$AnnotationSorter$3$ ()), Clazz.innerTypeInstance (jalview.analysis.AnnotationSorter$3, this, null));
+});
+Clazz.makeConstructor (c$, 
+function (alignmentI, showAutocalculatedAbove) {
+this.alignment = alignmentI;
+this.showAutocalcAbove = showAutocalculatedAbove;
+}, "jalview.datamodel.AlignmentI,~B");
+Clazz.defineMethod (c$, "sort", 
+function (alignmentAnnotations, order) {
+if (alignmentAnnotations == null) {
+return;
+}this.saveSequenceIndices (alignmentAnnotations);
+var comparator = this.getComparator (order);
+if (alignmentAnnotations != null) {
+{
+java.util.Arrays.sort (alignmentAnnotations, comparator);
+}}}, "~A,jalview.analysis.AnnotationSorter.SequenceAnnotationOrder");
+Clazz.defineMethod (c$, "saveSequenceIndices", 
+ function (alignmentAnnotations) {
+this.sequenceIndices.clear ();
+for (var ann, $ann = 0, $$ann = alignmentAnnotations; $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) {
+var seq = ann.sequenceRef;
+if (seq != null) {
+var index = jalview.analysis.AlignmentUtils.getSequenceIndex (this.alignment, seq);
+this.sequenceIndices.put (seq, new Integer (index));
+}}
+}, "~A");
+Clazz.defineMethod (c$, "getComparator", 
+ function (order) {
+if (order == null) {
+return this.noSort;
+}switch (order) {
+case jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.NONE:
+return this.noSort;
+case jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.SEQUENCE_AND_LABEL:
+return this.bySequenceAndLabel;
+case jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.LABEL_AND_SEQUENCE:
+return this.byLabelAndSequence;
+default:
+throw  new UnsupportedOperationException (order.toString ());
+}
+}, "jalview.analysis.AnnotationSorter.SequenceAnnotationOrder");
+Clazz.defineMethod (c$, "compareLabels", 
+ function (o1, o2) {
+if (o1 == null || o2 == null) {
+return 0;
+}var label1 = o1.label;
+var label2 = o2.label;
+if (label1 == null && label2 == null) {
+return 0;
+}if (label1 == null) {
+return -1;
+}if (label2 == null) {
+return 1;
+}return label1.toUpperCase ().compareTo (label2.toUpperCase ());
+}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");
+Clazz.defineMethod (c$, "compareSequences", 
+ function (o1, o2) {
+var seq1 = o1.sequenceRef;
+var seq2 = o2.sequenceRef;
+if (seq1 == null && seq2 == null) {
+return 0;
+}if (seq1 == null) {
+return this.showAutocalcAbove ? -1 : 1;
+}if (seq2 == null) {
+return this.showAutocalcAbove ? 1 : -1;
+}var index1 = (this.sequenceIndices.get (seq1)).intValue ();
+var index2 = (this.sequenceIndices.get (seq2)).intValue ();
+if (index1 == index2) {
+return 0;
+}if (index1 == -1) {
+return -1;
+}if (index2 == -1) {
+return 1;
+}return Integer.compare (index1, index2);
+}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");
+c$.$AnnotationSorter$1$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.declareAnonymous (jalview.analysis, "AnnotationSorter$1", null, java.util.Comparator);
+Clazz.overrideMethod (c$, "compare", 
+function (o1, o2) {
+if (o1 == null && o2 == null) {
+return 0;
+}if (o1 == null) {
+return -1;
+}if (o2 == null) {
+return 1;
+}if (o1.sequenceRef == null && o2.sequenceRef == null) {
+return 0;
+}var sequenceOrder = this.b$["jalview.analysis.AnnotationSorter"].compareSequences (o1, o2);
+return sequenceOrder == 0 ? this.b$["jalview.analysis.AnnotationSorter"].compareLabels (o1, o2) : sequenceOrder;
+}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");
+c$ = Clazz.p0p ();
+};
+c$.$AnnotationSorter$2$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.declareAnonymous (jalview.analysis, "AnnotationSorter$2", null, java.util.Comparator);
+Clazz.overrideMethod (c$, "compare", 
+function (o1, o2) {
+if (o1 == null && o2 == null) {
+return 0;
+}if (o1 == null) {
+return -1;
+}if (o2 == null) {
+return 1;
+}if (o1.sequenceRef == null && o2.sequenceRef == null) {
+return 0;
+}if (o1.sequenceRef == null) {
+return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? -1 : 1;
+}if (o2.sequenceRef == null) {
+return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? 1 : -1;
+}var labelOrder = this.b$["jalview.analysis.AnnotationSorter"].compareLabels (o1, o2);
+return labelOrder == 0 ? this.b$["jalview.analysis.AnnotationSorter"].compareSequences (o1, o2) : labelOrder;
+}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");
+c$ = Clazz.p0p ();
+};
+c$.$AnnotationSorter$3$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.declareAnonymous (jalview.analysis, "AnnotationSorter$3", null, java.util.Comparator);
+Clazz.overrideMethod (c$, "compare", 
+function (o1, o2) {
+if (o1 != null && o2 != null) {
+if (o1.sequenceRef == null && o2.sequenceRef != null) {
+return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? -1 : 1;
+}if (o1.sequenceRef != null && o2.sequenceRef == null) {
+return this.b$["jalview.analysis.AnnotationSorter"].showAutocalcAbove ? 1 : -1;
+}}return 0;
+}, "jalview.datamodel.AlignmentAnnotation,jalview.datamodel.AlignmentAnnotation");
+c$ = Clazz.p0p ();
+};
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+this.description = null;
+Clazz.instantialize (this, arguments);
+}, jalview.analysis.AnnotationSorter, "SequenceAnnotationOrder", Enum);
+Clazz.makeConstructor (c$, 
+ function (a) {
+this.description = a;
+}, "~S");
+Clazz.overrideMethod (c$, "toString", 
+function () {
+return this.description;
+});
+c$.forDescription = Clazz.defineMethod (c$, "forDescription", 
+function (a) {
+for (var order, $order = 0, $$order = jalview.analysis.AnnotationSorter.SequenceAnnotationOrder.values (); $order < $$order.length && ((order = $$order[$order]) || true); $order++) {
+if (order.toString ().equals (a)) {
+return order;
+}}
+return null;
+}, "~S");
+Clazz.defineEnumConstant (c$, "SEQUENCE_AND_LABEL", 0, ["Sequence"]);
+Clazz.defineEnumConstant (c$, "LABEL_AND_SEQUENCE", 1, ["Label"]);
+Clazz.defineEnumConstant (c$, "NONE", 2, ["No sort"]);
+c$ = Clazz.p0p ();
+});