From: <ha...@us...> - 2009-11-04 04:40:40
|
Revision: 11665 http://jmol.svn.sourceforge.net/jmol/?rev=11665&view=rev Author: hansonr Date: 2009-11-04 04:40:32 +0000 (Wed, 04 Nov 2009) Log Message: ----------- version=11.8.8 # bug fix: function _xxxx global -- but that's in state functions! -- now "global_xxx" are global functions Modified Paths: -------------- branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties branches/v11_8/Jmol/src/org/jmol/viewer/StateManager.java branches/v11_8/Jmol/src/org/jmol/viewer/Viewer.java Modified: branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties 2009-11-03 20:05:19 UTC (rev 11664) +++ branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties 2009-11-04 04:40:32 UTC (rev 11665) @@ -4,6 +4,7 @@ version=11.8.8 +# bug fix: function _xxxx global -- but that's in state functions! -- now "global_xxx" are global functions # bug fix: jmol -ionxs with a script that includes measurement tries to update a nonexistant measurementTable # bug fix: select xxx when xxx is an array fails to do lookup of defined values # bug fix: legacy code: Bond.getBondModelIndex returning atomIndex instead Modified: branches/v11_8/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- branches/v11_8/Jmol/src/org/jmol/viewer/StateManager.java 2009-11-03 20:05:19 UTC (rev 11664) +++ branches/v11_8/Jmol/src/org/jmol/viewer/StateManager.java 2009-11-04 04:40:32 UTC (rev 11665) @@ -464,22 +464,36 @@ "angstroms;au;bohr;nanometers;nm;picometers;pm"); } - final static Hashtable globalFunctions = new Hashtable(); - Hashtable localFunctions = new Hashtable(); + private final static Hashtable globalFunctions = new Hashtable(); + private Hashtable localFunctions = new Hashtable(); + + public Hashtable getFunctions(boolean isLocal) { + return (isLocal ? localFunctions : globalFunctions); + } + + public void clearFunctions() { + globalFunctions.clear(); + localFunctions.clear(); + } + + private static boolean isGlobalFunction(String name) { + return name.startsWith("global_"); + } + boolean isFunction(String name) { - return (name.indexOf("_") == 0 ? globalFunctions : localFunctions).containsKey(name); + return (isGlobalFunction(name) ? globalFunctions : localFunctions).containsKey(name); } void addFunction(ScriptFunction function) { - (function.name.indexOf("_") == 0 ? globalFunctions + (isGlobalFunction(function.name) ? globalFunctions : localFunctions).put(function.name, function); } ScriptFunction getFunction(String name) { if (name == null) return null; - ScriptFunction function = (ScriptFunction) (name.indexOf("_") == 0 ? globalFunctions + ScriptFunction function = (ScriptFunction) (isGlobalFunction(name) ? globalFunctions : localFunctions).get(name); return (function == null || function.aatoken == null ? null : function); } Modified: branches/v11_8/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- branches/v11_8/Jmol/src/org/jmol/viewer/Viewer.java 2009-11-03 20:05:19 UTC (rev 11664) +++ branches/v11_8/Jmol/src/org/jmol/viewer/Viewer.java 2009-11-04 04:40:32 UTC (rev 11665) @@ -7775,18 +7775,16 @@ stateManager.addFunction(f); } - void clearFunctions() { - StateManager.globalFunctions.clear(); - stateManager.localFunctions.clear(); + public void clearFunctions() { + stateManager.clearFunctions(); } - boolean isFunction(String name) { + public boolean isFunction(String name) { return stateManager.isFunction(name); } - Hashtable getFunctions(boolean isLocal) { - return (isLocal ? stateManager.localFunctions - : StateManager.globalFunctions); + public Hashtable getFunctions(boolean isLocal) { + return stateManager.getFunctions(isLocal); } void showMessage(String s) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |