From: hansonr Date: Sun, 31 Mar 2019 17:18:36 +0000 (-0500) Subject: clean up implicit object refs X-Git-Tag: Release_2_11_4_0~45^2~18^2~196 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0cbece350537dfb7ecccfb50fe9e24f7df42f7b3;p=jalview.git clean up implicit object refs --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index ef57d5f..270023e 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -153,12 +153,15 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; +import ext.vamsas.ServiceHandle; + /** * DOCUMENT ME! * * @author $author$ * @version $Revision$ */ +@SuppressWarnings("serial") public class AlignFrame extends GAlignFrame implements DropTargetListener, IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener { @@ -2081,7 +2084,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, && Desktop.jalviewClipboard[1] != alignment.getDataset(); // importDs==true instructs us to copy over new dataset sequences from // an existing alignment - Vector newDs = (importDs) ? new Vector() : null; // used to create + Vector newDs = (importDs) ? new Vector<>() : null; // used to + // create // minimum dataset set for (int i = 0; i < sequences.length; i++) @@ -3029,7 +3033,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param toggleSeqs * @param toggleCols */ - private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) + protected void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) { boolean hide = false; @@ -3809,7 +3813,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { sortByAnnotScore.removeAll(); // almost certainly a quicker way to do this - but we keep it simple - Hashtable scoreSorts = new Hashtable(); + Hashtable scoreSorts = new Hashtable<>(); AlignmentAnnotation aann[]; for (SequenceI sqa : viewport.getAlignment().getSequences()) { @@ -3822,11 +3826,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } } - Enumeration labels = scoreSorts.keys(); + Enumeration labels = scoreSorts.keys(); while (labels.hasMoreElements()) { addSortByAnnotScoreMenuItem(sortByAnnotScore, - (String) labels.nextElement()); + labels.nextElement()); } sortByAnnotScore.setVisible(scoreSorts.size() > 0); scoreSorts.clear(); @@ -4154,14 +4158,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // No MSAWS used any more: // Vector msaws = null; // (Vector) // Discoverer.services.get("MsaWS"); - Vector secstrpr = (Vector) Discoverer.services + Vector secstrpr = Discoverer.services .get("SecStrPred"); if (secstrpr != null) { // Add any secondary structure prediction services for (int i = 0, j = secstrpr.size(); i < j; i++) { - final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr + final ext.vamsas.ServiceHandle sh = secstrpr .get(i); jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer .getServiceClient(sh); @@ -4271,7 +4275,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * * @param webService */ - private void build_urlServiceMenu(JMenu webService) + protected void build_urlServiceMenu(JMenu webService) { // TODO: remove this code when 2.7 is released // DEBUG - alignmentView diff --git a/src/jalview/ws/jws1/Discoverer.java b/src/jalview/ws/jws1/Discoverer.java index ea883c8..bee9fad 100644 --- a/src/jalview/ws/jws1/Discoverer.java +++ b/src/jalview/ws/jws1/Discoverer.java @@ -23,6 +23,7 @@ package jalview.ws.jws1; import jalview.gui.JvOptionPane; import jalview.util.MessageManager; +import java.net.URL; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; @@ -111,21 +112,20 @@ public class Discoverer implements Runnable static private java.net.URL RootServiceURL = null; - static public Vector ServiceURLList = null; + static public Vector ServiceURLList = null; static private boolean reallyDiscoverServices = true; - public static java.util.Hashtable services = null; // vectors of services - + public static java.util.Hashtable> services = null; // stored by // abstractServiceType // string - public static java.util.Vector serviceList = null; // flat list of services + public static java.util.Vector serviceList = null; - static private Vector getDiscoveryURLS() + static private Vector getDiscoveryURLS() { - Vector urls = new Vector(); + Vector urls = new Vector<>(); String RootServiceURLs = jalview.bin.Cache.getDefault("DISCOVERY_URLS", "http://www.compbio.dundee.ac.uk/JalviewWS/services/ServiceRegistry"); @@ -189,7 +189,7 @@ public class Discoverer implements Runnable else { jalview.bin.Cache.log.debug("Setting default services"); - services = new Hashtable(); + services = new Hashtable<>(); // Muscle, Clustal and JPred. ServiceHandle[] defServices = { new ServiceHandle("MsaWS", "Edgar, Robert C. (2004), MUSCLE: multiple sequence alignment " @@ -217,8 +217,8 @@ public class Discoverer implements Runnable + "\ndoi://10.1093/nar/gkv332", "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred", "JPred Secondary Structure Prediction") }; - services = new Hashtable(); - serviceList = new Vector(); + services = new Hashtable<>(); + serviceList = new Vector<>(); buildServiceLists(defServices, serviceList, services); } @@ -284,8 +284,9 @@ public class Discoverer implements Runnable * Hashtable * @return boolean */ - static private boolean buildServiceLists(ServiceHandle[] sh, Vector cat, - Hashtable sscat) + static private boolean buildServiceLists(ServiceHandle[] sh, + Vector cat, + Hashtable> sscat) { boolean seenNewDiscovery = false; for (int i = 0, j = sh.length; i < j; i++) @@ -297,11 +298,11 @@ public class Discoverer implements Runnable + sh[i].getEndpointURL() + "\n"); if (!sscat.containsKey(sh[i].getAbstractName())) { - sscat.put(sh[i].getAbstractName(), cat = new Vector()); + sscat.put(sh[i].getAbstractName(), cat = new Vector<>()); } else { - cat = (Vector) sscat.get(sh[i].getAbstractName()); + cat = sscat.get(sh[i].getAbstractName()); } cat.add(sh[i]); if (sh[i].getAbstractName().equals("Registry")) @@ -334,8 +335,8 @@ public class Discoverer implements Runnable public void discoverServices() { - Hashtable sscat = new Hashtable(); - Vector cat = new Vector(); + Hashtable> sscat = new Hashtable<>(); + Vector cat = new Vector<>(); ServiceHandle sh[] = null; int s_url = 0; if (ServiceURLList == null) @@ -347,7 +348,7 @@ public class Discoverer implements Runnable while (s_url < ServiceURLList.size()) { if ((sh = getServices( - (java.net.URL) ServiceURLList.get(s_url))) != null) + ServiceURLList.get(s_url))) != null) { buildServiceLists(sh, cat, sscat); @@ -365,7 +366,7 @@ public class Discoverer implements Runnable // so no need to access original discovery thread. // Curent decision is to change properties then notify listeners with old // and new values. - Hashtable oldServices = services; + Hashtable> oldServices = services; // Vector oldServicelist = serviceList; services = sscat; serviceList = cat; @@ -384,7 +385,7 @@ public class Discoverer implements Runnable @Override public void run() { - discoverer.doDiscovery(); + Discoverer.doDiscovery(); discoverer.discoverServices(); } }; @@ -394,19 +395,19 @@ public class Discoverer implements Runnable /** * binding service abstract name to handler class */ - private static Hashtable serviceClientBindings; + private static Hashtable serviceClientBindings; public static WS1Client getServiceClient(ServiceHandle sh) { if (serviceClientBindings == null) { // get a list from Config or create below - serviceClientBindings = new Hashtable(); + serviceClientBindings = new Hashtable<>(); serviceClientBindings.put("MsaWS", new MsaWSClient()); serviceClientBindings.put("SecStrPred", new JPredClient()); serviceClientBindings.put("SeqSearch", new SeqSearchWSClient()); } - WS1Client instance = (WS1Client) serviceClientBindings + WS1Client instance = serviceClientBindings .get(sh.getAbstractName()); if (instance == null) {