From 63c563ea81cef0fc7743a08a45d6b43a9818d033 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 20 Jul 2016 16:18:01 +0100 Subject: [PATCH] =?utf8?q?JAL-1926=20JAL-2106=20use=20enum=20for=20=E2=80=98?= =?utf8?q?DEFAULT=5FSTRUCTURE=5FFORMAT=E2=80=99=20property=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/structure/StructureImportSettings.java | 11 +++++++++-- src/jalview/ws/dbsources/Pdb.java | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/jalview/structure/StructureImportSettings.java b/src/jalview/structure/StructureImportSettings.java index b23fd53..8a321ce 100644 --- a/src/jalview/structure/StructureImportSettings.java +++ b/src/jalview/structure/StructureImportSettings.java @@ -27,6 +27,12 @@ public class StructureImportSettings private static boolean processHETATMs = false; private static String currentDefaultFormat = DBRefSource.PDB; + public enum StructureFormat + { + PDB, MMCIF + }; + + private static StructureFormat currentDefaultFormat = StructureFormat.PDB; public static void addSettings(boolean addAlignmentAnnotations, boolean predictSecStr, boolean externalSecStr) @@ -82,12 +88,13 @@ public class StructureImportSettings public static String getCurrentDefaultFormat() { - return currentDefaultFormat; + return currentDefaultFormat.toString(); } public static void setCurrentDefaultFormat(String currentDefaultFormat) { - StructureImportSettings.currentDefaultFormat = currentDefaultFormat; + StructureImportSettings.currentDefaultFormat = StructureFormat + .valueOf(currentDefaultFormat); } public static boolean isProcessHETATMs() diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index d945699..a06f0c8 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -31,6 +31,7 @@ import jalview.datamodel.SequenceI; import jalview.io.FormatAdapter; import jalview.io.PDBFeatureSettings; import jalview.structure.StructureImportSettings; +import jalview.structure.StructureImportSettings.StructureFormat; import jalview.util.MessageManager; import jalview.ws.ebi.EBIFetchClient; @@ -132,9 +133,8 @@ public class Pdb extends EbiFileRetrievedProxy stopQuery(); return null; } - String ext = StructureImportSettings.getCurrentDefaultFormat() - .equalsIgnoreCase("mmcif") ? ".cif" - : ".xml"; + String ext = StructureImportSettings.getCurrentDefaultFormat().equals( + StructureFormat.MMCIF) ? ".cif" : ".xml"; EBIFetchClient ebi = new EBIFetchClient(); file = ebi.fetchDataAsFile("pdb:" + id, StructureImportSettings.getCurrentDefaultFormat().toLowerCase(), -- 1.7.10.2