Revision: 20288 http://sourceforge.net/p/jmol/code/20288 Author: hansonr Date: 2015-02-12 12:48:51 +0000 (Thu, 12 Feb 2015) Log Message: -----------
Modified Paths: -------------- trunk/Jmol/src/javajs/util/PT.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/javajs/util/PT.java =================================================================== --- trunk/Jmol/src/javajs/util/PT.java 2015-02-12 12:46:39 UTC (rev 20287) +++ trunk/Jmol/src/javajs/util/PT.java 2015-02-12 12:48:51 UTC (rev 20288) @@ -388,18 +388,14 @@ public static String parseTokenNext(String str, int[] next) { int cch = str.length(); - if (next[0] < 0 || next[0] >= cch) - return null; - return parseTokenChecked(str, cch, next); + return (next[0] < 0 || next[0] >= cch ? null : parseTokenChecked(str, cch, next)); } public static String parseTokenRange(String str, int ichMax, int[] next) { int cch = str.length(); if (ichMax > cch) ichMax = cch; - if (next[0] < 0 || next[0] >= ichMax) - return null; - return parseTokenChecked(str, ichMax, next); + return (next[0] < 0 || next[0] >= ichMax ? null : parseTokenChecked(str, ichMax, next)); } public static String parseTokenChecked(String str, int ichMax, int[] next) { @@ -410,9 +406,7 @@ while (ich < ichMax && !isWhiteSpace(str, ich)) ++ich; next[0] = ich; - if (ichNonWhite == ich) - return null; - return str.substring(ichNonWhite, ich); + return (ichNonWhite == ich ? null : str.substring(ichNonWhite, ich)); } public static String parseTrimmedChecked(String str, int ich, int ichMax) { @@ -421,9 +415,7 @@ int ichLast = ichMax - 1; while (ichLast >= ich && isWhiteSpace(str, ichLast)) --ichLast; - if (ichLast < ich) - return ""; - return str.substring(ich, ichLast + 1); + return (ichLast < ich ? "" : str.substring(ich, ichLast + 1)); } public static double dVal(String s) throws NumberFormatException { @@ -458,9 +450,7 @@ int cch = str.length(); if (ichMax > cch) ichMax = cch; - if (next[0] < 0 || next[0] >= ichMax) - return Integer.MIN_VALUE; - return parseIntChecked(str, ichMax, next); + return (next[0] < 0 || next[0] >= ichMax ? Integer.MIN_VALUE : parseIntChecked(str, ichMax, next)); } /** Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-02-12 12:46:39 UTC (rev 20287) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-02-12 12:48:51 UTC (rev 20288) @@ -1719,17 +1719,21 @@ /** * obtain CIF data for a ligand for purposes of adding hydrogens + * or for any other purpose in terms of saving a data set for a file + * in a state * * @param id - * if null, clear "bad" entries from the set. + * unique key; if null, clear "bad" entries from the set. * @param prefix - * @param suffix + * @param suffix or fileName * @param terminator * Only save to this if not null * @return a ligand model or a string if just file data or null */ public Object getLigandModel(String id, String prefix, String suffix, String terminator) { + // getLigandModel(id, m40File, "_file", "----")); + // getLigandModel(group3, "ligand_", "_data", null); if (id == null) { if (ligandModelSet != null) { Iterator<Map.Entry<String, Object>> e = ligandModels.entrySet() @@ -1745,6 +1749,8 @@ boolean isLigand = prefix.equals("ligand_"); if (isLigand) id = id.toUpperCase(); + else + id = id.substring(id.lastIndexOf("/") + 1); if (ligandModelSet == null) ligandModelSet = new Hashtable<String, Boolean>(); ligandModelSet.put(id, Boolean.TRUE); @@ -1782,6 +1788,8 @@ } if (!isLigand) return model; + // process ligand business + if (!isError && model instanceof String) { data = (String) model; // TODO: check for errors in reading file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits