JAL-1807 test
[jalviewjs.git] / bin / jalview / analysis / SequenceIdMatcher.js
index 6e94b5f..adb0a5a 100644 (file)
-Clazz.declarePackage ("jalview.analysis");\r
-Clazz.load (null, "jalview.analysis.SequenceIdMatcher", ["java.util.ArrayList", "$.Arrays", "$.HashMap", "$.Vector"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.names = null;\r
-if (!Clazz.isClassDefined ("jalview.analysis.SequenceIdMatcher.SeqIdName")) {\r
-jalview.analysis.SequenceIdMatcher.$SequenceIdMatcher$SeqIdName$ ();\r
-}\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.analysis, "SequenceIdMatcher");\r
-Clazz.makeConstructor (c$, \r
-function (seqs) {\r
-this.names =  new java.util.HashMap ();\r
-this.addAll (seqs);\r
-}, "java.util.List");\r
-Clazz.defineMethod (c$, "addAll", \r
-function (seqs) {\r
-for (var seq, $seq = seqs.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {\r
-this.names.put (Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seq.getDisplayId (true)), seq);\r
-var dbseq = seq;\r
-while (dbseq.getDatasetSequence () != null) {\r
-dbseq = dbseq.getDatasetSequence ();\r
-}\r
-if (dbseq.getDBRef () != null) {\r
-var dbr = dbseq.getDBRef ();\r
-var sid = null;\r
-for (var r = 0; r < dbr.length; r++) {\r
-sid = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, dbr[r].getAccessionId ());\r
-if (!this.names.containsKey (sid)) {\r
-this.names.put (sid, seq);\r
-}}\r
-}}\r
-}, "java.util.List");\r
-Clazz.makeConstructor (c$, \r
-function (sequences) {\r
-this.construct (java.util.Arrays.asList (sequences));\r
-}, "~A");\r
-Clazz.defineMethod (c$, "pickbestMatch", \r
-($fz = function (candName, matches) {\r
-var st = this.pickbestMatches (candName, matches);\r
-return st == null || st.size () == 0 ? null : st.get (0);\r
-}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName,java.util.List");\r
-Clazz.defineMethod (c$, "pickbestMatches", \r
-($fz = function (candName, matches) {\r
-var best =  new java.util.ArrayList ();\r
-if (candName == null || matches == null || matches.size () == 0) {\r
-return null;\r
-}var match = matches.remove (0);\r
-best.add (match);\r
-this.names.put (Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, match.getName ()), match);\r
-var matchlen = match.getName ().length;\r
-var namlen = candName.id.length;\r
-while (matches.size () > 0) {\r
-var cand = matches.remove (0);\r
-this.names.put (Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, cand.getName ()), cand);\r
-var q;\r
-var w;\r
-var candlen = cand.getName ().length;\r
-if ((q = Math.abs (matchlen - namlen)) > (w = Math.abs (candlen - namlen)) && candlen > matchlen) {\r
-best.clear ();\r
-match = cand;\r
-matchlen = candlen;\r
-best.add (match);\r
-}if (q == w && candlen == matchlen) {\r
-best.add (cand);\r
-}}\r
-if (best.size () == 0) {\r
-return null;\r
-};return best;\r
-}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName,java.util.List");\r
-Clazz.defineMethod (c$, "findIdMatch", \r
-function (seq) {\r
-var nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seq.getName ());\r
-return this.findIdMatch (nam);\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "findIdMatch", \r
-function (seqnam) {\r
-var nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seqnam);\r
-return this.findIdMatch (nam);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "findAllIdMatches", \r
-function (seqnam) {\r
-var nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seqnam);\r
-var m = this.findAllIdMatches (nam);\r
-if (m != null) {\r
-return m.toArray ( new Array (m.size ()));\r
-}return null;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "findIdMatch", \r
-function (seqs) {\r
-var namedseqs = null;\r
-var i = 0;\r
-var nam;\r
-if (seqs.length > 0) {\r
-namedseqs =  new Array (seqs.length);\r
-do {\r
-nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seqs[i].getName ());\r
-if (this.names.containsKey (nam)) {\r
-namedseqs[i] = this.findIdMatch (nam);\r
-} else {\r
-namedseqs[i] = null;\r
-}} while (++i < seqs.length);\r
-}return namedseqs;\r
-}, "~A");\r
-Clazz.defineMethod (c$, "findIdMatch", \r
-($fz = function (nam) {\r
-var matches =  new java.util.Vector ();\r
-while (this.names.containsKey (nam)) {\r
-matches.addElement (this.names.remove (nam));\r
-}\r
-return this.pickbestMatch (nam, matches);\r
-}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName");\r
-Clazz.defineMethod (c$, "findAllIdMatches", \r
-($fz = function (nam) {\r
-var matches =  new java.util.ArrayList ();\r
-while (this.names.containsKey (nam)) {\r
-matches.add (this.names.remove (nam));\r
-}\r
-var r = this.pickbestMatches (nam, matches);\r
-return r;\r
-}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName");\r
-c$.$SequenceIdMatcher$SeqIdName$ = function () {\r
-Clazz.pu$h ();\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-this.id = null;\r
-this.WORD_SEP = "~. |#\\/<>!\"\u00a4$%^*)}[@\',?_";\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.analysis.SequenceIdMatcher, "SeqIdName");\r
-Clazz.makeConstructor (c$, \r
-function (a) {\r
-if (a != null) {\r
-this.id =  String.instantialize (a);\r
-} else {\r
-this.id = "";\r
-}}, "~S");\r
-Clazz.overrideMethod (c$, "hashCode", \r
-function () {\r
-return ((this.id.length >= 4) ? this.id.substring (0, 4).hashCode () : this.id.hashCode ());\r
-});\r
-Clazz.defineMethod (c$, "equals", \r
-function (a) {\r
-if (a == null) {\r
-return false;\r
-}if (Clazz.instanceOf (a, jalview.analysis.SequenceIdMatcher.SeqIdName)) {\r
-return this.equals (a);\r
-} else {\r
-if (Clazz.instanceOf (a, String)) {\r
-return this.equals (a);\r
-}}return false;\r
-}, "~O");\r
-Clazz.defineMethod (c$, "equals", \r
-function (a) {\r
-if (this.id.length > a.id.length) {\r
-return this.id.startsWith (a.id) ? (this.WORD_SEP.indexOf (this.id.charAt (a.id.length)) > -1) : false;\r
-} else {\r
-return a.id.startsWith (this.id) ? (a.id.equals (this.id) ? true : (this.WORD_SEP.indexOf (a.id.charAt (this.id.length)) > -1)) : false;\r
-}}, "jalview.analysis.SequenceIdMatcher.SeqIdName");\r
-Clazz.defineMethod (c$, "equals", \r
-function (a) {\r
-if (this.id.length > a.length) {\r
-return this.id.startsWith (a) ? (this.WORD_SEP.indexOf (this.id.charAt (a.length)) > -1) : false;\r
-} else {\r
-return a.startsWith (this.id) ? (a.equals (this.id) ? true : (this.WORD_SEP.indexOf (a.charAt (this.id.length)) > -1)) : false;\r
-}}, "~S");\r
-c$ = Clazz.p0p ();\r
-};\r
-});\r
+Clazz.declarePackage ("jalview.analysis");
+Clazz.load (null, "jalview.analysis.SequenceIdMatcher", ["java.util.ArrayList", "$.Arrays", "$.HashMap", "$.Vector"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.names = null;
+if (!Clazz.isClassDefined ("jalview.analysis.SequenceIdMatcher.SeqIdName")) {
+jalview.analysis.SequenceIdMatcher.$SequenceIdMatcher$SeqIdName$ ();
+}
+Clazz.instantialize (this, arguments);
+}, jalview.analysis, "SequenceIdMatcher");
+Clazz.makeConstructor (c$, 
+function (seqs) {
+this.names =  new java.util.HashMap ();
+this.addAll (seqs);
+}, "java.util.List");
+Clazz.defineMethod (c$, "addAll", 
+function (seqs) {
+for (var seq, $seq = seqs.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
+this.names.put (Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seq.getDisplayId (true)), seq);
+var dbseq = seq;
+while (dbseq.getDatasetSequence () != null) {
+dbseq = dbseq.getDatasetSequence ();
+}
+if (dbseq.getDBRef () != null) {
+var dbr = dbseq.getDBRef ();
+var sid = null;
+for (var r = 0; r < dbr.length; r++) {
+sid = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, dbr[r].getAccessionId ());
+if (!this.names.containsKey (sid)) {
+this.names.put (sid, seq);
+}}
+}}
+}, "java.util.List");
+Clazz.makeConstructor (c$, 
+function (sequences) {
+this.construct (java.util.Arrays.asList (sequences));
+}, "~A");
+Clazz.defineMethod (c$, "pickbestMatch", 
+($fz = function (candName, matches) {
+var st = this.pickbestMatches (candName, matches);
+return st == null || st.size () == 0 ? null : st.get (0);
+}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName,java.util.List");
+Clazz.defineMethod (c$, "pickbestMatches", 
+($fz = function (candName, matches) {
+var best =  new java.util.ArrayList ();
+if (candName == null || matches == null || matches.size () == 0) {
+return null;
+}var match = matches.remove (0);
+best.add (match);
+this.names.put (Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, match.getName ()), match);
+var matchlen = match.getName ().length;
+var namlen = candName.id.length;
+while (matches.size () > 0) {
+var cand = matches.remove (0);
+this.names.put (Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, cand.getName ()), cand);
+var q;
+var w;
+var candlen = cand.getName ().length;
+if ((q = Math.abs (matchlen - namlen)) > (w = Math.abs (candlen - namlen)) && candlen > matchlen) {
+best.clear ();
+match = cand;
+matchlen = candlen;
+best.add (match);
+}if (q == w && candlen == matchlen) {
+best.add (cand);
+}}
+if (best.size () == 0) {
+return null;
+};return best;
+}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName,java.util.List");
+Clazz.defineMethod (c$, "findIdMatch", 
+function (seq) {
+var nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seq.getName ());
+return this.findIdMatch (nam);
+}, "jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "findIdMatch", 
+function (seqnam) {
+var nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seqnam);
+return this.findIdMatch (nam);
+}, "~S");
+Clazz.defineMethod (c$, "findAllIdMatches", 
+function (seqnam) {
+var nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seqnam);
+var m = this.findAllIdMatches (nam);
+if (m != null) {
+return m.toArray ( new Array (m.size ()));
+}return null;
+}, "~S");
+Clazz.defineMethod (c$, "findIdMatch", 
+function (seqs) {
+var namedseqs = null;
+var i = 0;
+var nam;
+if (seqs.length > 0) {
+namedseqs =  new Array (seqs.length);
+do {
+nam = Clazz.innerTypeInstance (jalview.analysis.SequenceIdMatcher.SeqIdName, this, null, seqs[i].getName ());
+if (this.names.containsKey (nam)) {
+namedseqs[i] = this.findIdMatch (nam);
+} else {
+namedseqs[i] = null;
+}} while (++i < seqs.length);
+}return namedseqs;
+}, "~A");
+Clazz.defineMethod (c$, "findIdMatch", 
+($fz = function (nam) {
+var matches =  new java.util.Vector ();
+while (this.names.containsKey (nam)) {
+matches.addElement (this.names.remove (nam));
+}
+return this.pickbestMatch (nam, matches);
+}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName");
+Clazz.defineMethod (c$, "findAllIdMatches", 
+($fz = function (nam) {
+var matches =  new java.util.ArrayList ();
+while (this.names.containsKey (nam)) {
+matches.add (this.names.remove (nam));
+}
+var r = this.pickbestMatches (nam, matches);
+return r;
+}, $fz.isPrivate = true, $fz), "jalview.analysis.SequenceIdMatcher.SeqIdName");
+c$.$SequenceIdMatcher$SeqIdName$ = function () {
+Clazz.pu$h ();
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+this.id = null;
+this.WORD_SEP = "~. |#\\/<>!\"\u00a4$%^*)}[@\',?_";
+Clazz.instantialize (this, arguments);
+}, jalview.analysis.SequenceIdMatcher, "SeqIdName");
+Clazz.makeConstructor (c$, 
+function (a) {
+if (a != null) {
+this.id =  String.instantialize (a);
+} else {
+this.id = "";
+}}, "~S");
+Clazz.overrideMethod (c$, "hashCode", 
+function () {
+return ((this.id.length >= 4) ? this.id.substring (0, 4).hashCode () : this.id.hashCode ());
+});
+Clazz.defineMethod (c$, "equals", 
+function (a) {
+if (a == null) {
+return false;
+}if (Clazz.instanceOf (a, jalview.analysis.SequenceIdMatcher.SeqIdName)) {
+return this.equals (a);
+} else {
+if (Clazz.instanceOf (a, String)) {
+return this.equals (a);
+}}return false;
+}, "~O");
+Clazz.defineMethod (c$, "equals", 
+function (a) {
+if (this.id.length > a.id.length) {
+return this.id.startsWith (a.id) ? (this.WORD_SEP.indexOf (this.id.charAt (a.id.length)) > -1) : false;
+} else {
+return a.id.startsWith (this.id) ? (a.id.equals (this.id) ? true : (this.WORD_SEP.indexOf (a.id.charAt (this.id.length)) > -1)) : false;
+}}, "jalview.analysis.SequenceIdMatcher.SeqIdName");
+Clazz.defineMethod (c$, "equals", 
+function (a) {
+if (this.id.length > a.length) {
+return this.id.startsWith (a) ? (this.WORD_SEP.indexOf (this.id.charAt (a.length)) > -1) : false;
+} else {
+return a.startsWith (this.id) ? (a.equals (this.id) ? true : (this.WORD_SEP.indexOf (a.charAt (this.id.length)) > -1)) : false;
+}}, "~S");
+c$ = Clazz.p0p ();
+};
+});