X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FDBRefUtils.java;fp=src%2Fjalview%2Futil%2FDBRefUtils.java;h=fb54bbabaad9e6585e5cee0eb3e20f8a91e8c3a2;hb=4f77328104498504339216829abf5ea87e2791ec;hp=197261ac154716b46c73f097d2aa58b160e51f01;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 197261a..fb54bba 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -32,6 +32,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import com.stevesoft.pat.Regex; @@ -95,14 +96,14 @@ public class DBRefUtils } // BH TODO (what?) - HashSet srcs = new HashSet<>(); + HashSet srcs = new HashSet(); for (String src : sources) { srcs.add(src.toUpperCase()); } int nrefs = dbrefs.size(); - List res = new ArrayList<>(); + List res = new ArrayList(); for (int ib = 0; ib < nrefs; ib++) { DBRefEntry dbr = dbrefs.get(ib); @@ -216,7 +217,7 @@ public class DBRefUtils * @return */ public static List searchRefs(List refs, String accId) { - List rfs = new ArrayList<>(); + List rfs = new ArrayList(); if (refs == null || accId == null) { return rfs; } @@ -242,7 +243,7 @@ public class DBRefUtils * @return */ static List searchRefs(List refs, DBRefEntry entry, DbRefComp comparator, int mode) { - List rfs = new ArrayList<>(); + List rfs = new ArrayList(); if (refs == null || entry == null) { return rfs; } @@ -449,14 +450,6 @@ public class DBRefUtils return matches; } - private static Regex PARSE_REGEX; - - private static Regex getParseRegex() - { - return (PARSE_REGEX == null ? PARSE_REGEX = Platform.newRegex( - "([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)", null) - : PARSE_REGEX); - } /** * Parses a DBRefEntry and adds it to the sequence, also a PDBEntry if the * database is PDB. @@ -478,7 +471,7 @@ public class DBRefUtils /* * Check for PFAM style stockhom PDB accession id citation e.g. "1WRI A; 7-80;" */ - Regex r = getParseRegex(); + Regex r = new com.stevesoft.pat.Regex("([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)"); if (r.search(acn.trim())) { String pdbid = r.stringMatched(1); String chaincode = r.stringMatched(2); @@ -565,7 +558,7 @@ public class DBRefUtils * @return */ public static List searchRefsForSource(List dbRefs, String source) { - List matches = new ArrayList<>(); + List matches = new ArrayList(); if (dbRefs != null && source != null) { for (DBRefEntry dbref : dbRefs) { if (source.equalsIgnoreCase(dbref.getSource())) { @@ -628,9 +621,7 @@ public class DBRefUtils bsSelect.set(0, dbrefs.size()); if (!selectRefsBS(dbrefs, isProtein ? DBRefSource.PROTEIN_MASK : DBRefSource.DNA_CODING_MASK, bsSelect)) - { - return; - } + return; // selfs.addAll(selfArray); // } @@ -640,9 +631,7 @@ public class DBRefUtils DBRefEntry p = pr.get(ip); for (int i = bsSelect.nextSetBit(0); i >= 0; i = bsSelect.nextSetBit(i + 1)) { if (dbrefs.get(i) == p) - { - bsSelect.clear(i); - } + bsSelect.clear(i); } // while (selfs.contains(p)) // { @@ -666,9 +655,7 @@ public class DBRefUtils // TODO: promote transcript refs ?? } if (keys == 0 || !selectRefsBS(dbrefs, keys, bsSelect)) - { - return; - } + return; // if (candidates != null) { for (int ic = bsSelect.nextSetBit(0); ic >= 0; ic = bsSelect.nextSetBit(ic + 1))