From: <ha...@us...> - 2013-10-29 18:44:24
|
Revision: 18864 http://sourceforge.net/p/jmol/code/18864 Author: hansonr Date: 2013-10-29 18:44:21 +0000 (Tue, 29 Oct 2013) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/popup/GenericPopup.java trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java trunk/Jmol/src/org/jmol/quantum/MepCalculation.java trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java trunk/Jmol/src/org/jmol/script/SV.java trunk/Jmol/src/org/jmol/script/ScriptCompiler.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/script/ScriptManager.java trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java trunk/Jmol/src/org/jmol/scriptext/ScriptExt.java Modified: trunk/Jmol/src/org/jmol/popup/GenericPopup.java =================================================================== --- trunk/Jmol/src/org/jmol/popup/GenericPopup.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/popup/GenericPopup.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -31,7 +31,7 @@ import org.jmol.util.Elements; import org.jmol.util.Escape; import org.jmol.util.Logger; -import org.jmol.util.Parser; +import javajs.util.Parser; import org.jmol.util.Txt; import org.jmol.viewer.JC; import org.jmol.viewer.Viewer; Modified: trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java =================================================================== --- trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -28,7 +28,7 @@ import org.jmol.i18n.GT; -import javajs.util.ParserJS; +import javajs.util.Parser; import javajs.util.SB; @@ -612,7 +612,7 @@ "front", GT._("Front"), "left", GT._("Left"), "right", GT._("Right"), - "top", ParserJS.split(GT._("Top[as in \"view from the top, from above\" - (translators: remove this bracketed part]"), "[")[0], + "top", Parser.split(GT._("Top[as in \"view from the top, from above\" - (translators: remove this bracketed part]"), "[")[0], "bottom", GT._("Bottom"), "back", GT._("Back"), Modified: trunk/Jmol/src/org/jmol/quantum/MepCalculation.java =================================================================== --- trunk/Jmol/src/org/jmol/quantum/MepCalculation.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/quantum/MepCalculation.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -39,7 +39,7 @@ import org.jmol.modelset.Atom; import org.jmol.util.Logger; import javajs.util.P3; -import javajs.util.ParserJS; +import javajs.util.Parser; /* * a simple molecular electrostatic potential cube generator @@ -230,12 +230,12 @@ while ((line = br.readLine()) != null) { if (line.startsWith("#")) continue; - String[] vs = ParserJS.getTokens(line); + String[] vs = Parser.getTokens(line); if (vs.length < 2) continue; if (Logger.debugging) Logger.debug(line); - htAtomicPotentials.put(vs[0], Float.valueOf(ParserJS.parseFloat(vs[1]))); + htAtomicPotentials.put(vs[0], Float.valueOf(Parser.parseFloat(vs[1]))); } br.close(); } catch (Exception e) { Modified: trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java =================================================================== --- trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -39,7 +39,7 @@ import org.jmol.modelset.Model; import org.jmol.util.Escape; import javajs.util.List; -import javajs.util.ParserJS; +import javajs.util.Parser; import javajs.util.SB; import org.jmol.util.Logger; @@ -309,7 +309,7 @@ Logger.info(line); if (line.indexOf("#") >= 0) continue; - String[] tokens = ParserJS.getTokens(line); + String[] tokens = Parser.getTokens(line); String name = tokens[0]; String defaultIso = tokens[2] + name; if (debugging) Modified: trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -36,7 +36,7 @@ import javajs.util.P3; import javajs.util.P3i; -import org.jmol.util.Parser; +import javajs.util.Parser; import javajs.util.V3; import org.jmol.java.BS; Modified: trunk/Jmol/src/org/jmol/script/SV.java =================================================================== --- trunk/Jmol/src/org/jmol/script/SV.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/script/SV.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -46,7 +46,7 @@ import javajs.util.M4; import javajs.util.P3; import javajs.util.P4; -import javajs.util.ParserJS; +import javajs.util.Parser; import org.jmol.util.Quaternion; import org.jmol.util.Txt; @@ -724,7 +724,7 @@ return 1; if (s.equalsIgnoreCase("false") || s.length() == 0) return 0; - return ParserJS.parseFloatStrict(s); + return Parser.parseFloatStrict(s); } static SV concatList(SV x1, SV x2, @@ -1120,7 +1120,7 @@ case 1: return sValue(args[0]); } - String[] format = ParserJS.split(Txt.simpleReplace(sValue(args[0]), "%%","\1"), "%"); + String[] format = Parser.split(Txt.simpleReplace(sValue(args[0]), "%%","\1"), "%"); SB sb = new SB(); sb.append(format[0]); for (int i = 1; i < format.length; i++) { Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -26,7 +26,7 @@ import org.jmol.util.Escape; import org.jmol.util.CommandHistory; import org.jmol.util.Logger; -import org.jmol.util.Parser; +import javajs.util.Parser; import org.jmol.util.Txt; import org.jmol.viewer.JC; import org.jmol.viewer.Viewer; @@ -39,7 +39,7 @@ import javajs.util.ArrayUtil; import javajs.util.List; -import javajs.util.ParserJS; +import javajs.util.Parser; import javajs.util.SB; import javajs.util.M3; import javajs.util.M4; @@ -1063,7 +1063,7 @@ case T.sync: if (nTokens == 1 && lookForSyncID()) { String ident = script.substring(ichToken, ichToken + cchToken); - int iident = javajs.util.ParserJS.parseInt(ident); + int iident = javajs.util.Parser.parseInt(ident); if (iident == Integer.MIN_VALUE || Math.abs(iident) < 1000) addTokenToPrefix(T.o(T.identifier, ident)); else @@ -1119,7 +1119,7 @@ return CONTINUE; } if (lookingAtDecimal()) { - value = ParserJS.fVal(script.substring(ichToken, ichToken + cchToken)); + value = Parser.fVal(script.substring(ichToken, ichToken + cchToken)); int intValue = (ScriptEvaluator.getFloatEncodedInt(script.substring( ichToken, ichToken + cchToken))); addTokenToPrefix(T.tv(T.decimal, intValue, Float.valueOf(value))); @@ -2398,7 +2398,7 @@ if (!isOK) return Float.NaN; cchToken = ichT - ichToken; - return (float) ParserJS.dVal(script.substring(pt0, ichT)); + return (float) Parser.dVal(script.substring(pt0, ichT)); } private boolean lookingAtDecimal() { Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -64,7 +64,7 @@ import org.jmol.util.JmolEdge; import org.jmol.util.Logger; import org.jmol.util.Measure; -import org.jmol.util.Parser; +import javajs.util.Parser; import org.jmol.util.ParserBS; import javajs.util.A4; @@ -73,7 +73,6 @@ import javajs.util.M4; import javajs.util.P3; import javajs.util.P4; -import javajs.util.ParserJS; import org.jmol.util.Quaternion; import org.jmol.util.Txt; @@ -1535,7 +1534,7 @@ String s = Atom.atomPropertyString(viewer, atom, tok); switch (minmaxtype) { case T.allfloat: - fout[i] = ParserJS.parseFloat(s); + fout[i] = Parser.parseFloat(s); break; default: if (vout == null) @@ -1644,7 +1643,7 @@ fout[i] = ((Integer) v).floatValue(); break; case 2: - fout[i] = ParserJS.parseFloat((String) v); + fout[i] = Parser.parseFloat((String) v); break; case 3: fout[i] = ((P3) v).length(); @@ -1800,7 +1799,7 @@ break; case T.string: if (sValue == null) - list = ParserJS.getTokens(SV.sValue(tokenValue)); + list = Parser.getTokens(SV.sValue(tokenValue)); break; } if (list != null) { @@ -1809,7 +1808,7 @@ fvalues = new float[nValues]; for (int i = nValues; --i >= 0;) fvalues[i] = (tok == T.element ? Elements.elementNumberFromSymbol( - list[i], false) : ParserJS.parseFloat(list[i])); + list[i], false) : Parser.parseFloat(list[i])); } if (tokenValue.tok != T.varray && nValues == 1) { if (isStrProperty) @@ -1921,7 +1920,7 @@ pt = extensions.indexOf("##SCRIPT_START="); if (pt < 0) return 0; - pt = javajs.util.ParserJS.parseInt(extensions.substring(pt + 15)); + pt = javajs.util.Parser.parseInt(extensions.substring(pt + 15)); if (pt == Integer.MIN_VALUE) return 0; for (pc = 0; pc < lineIndices.length; pc++) { @@ -4403,7 +4402,7 @@ case T.string: s = SV.sValue(st[i]); s = Txt.replaceAllCharacter(s, "{},[]\"'", ' '); - fparams = ParserJS.parseFloatArray(s); + fparams = Parser.parseFloatArray(s); n = fparams.length; break; case T.varray: @@ -4502,7 +4501,7 @@ if (s.startsWith("[\"")) { Object o = viewer.evaluateExpression(s); if (o instanceof String) - return ParserJS.split((String) o, "\n"); + return Parser.split((String) o, "\n"); } return new String[] { s }; case T.spacebeforesquare: @@ -7669,7 +7668,7 @@ if (slen < 3 || !(getToken(1).value instanceof String)) invArg(); String setName = ((String) getToken(1).value).toLowerCase(); - if (javajs.util.ParserJS.parseInt(setName) != Integer.MIN_VALUE) + if (javajs.util.Parser.parseInt(setName) != Integer.MIN_VALUE) invArg(); if (chk) return; @@ -9372,7 +9371,7 @@ checkLength(-3); String text = ""; String applet = ""; - int port = javajs.util.ParserJS.parseInt(optParameterAsString(1)); + int port = javajs.util.Parser.parseInt(optParameterAsString(1)); if (port == Integer.MIN_VALUE) { port = 0; switch (slen) { @@ -11187,7 +11186,7 @@ int modelNumber; boolean useModelNumber = false; if (modelDotted.indexOf(".") < 0) { - modelNumber = javajs.util.ParserJS.parseInt(modelDotted); + modelNumber = javajs.util.Parser.parseInt(modelDotted); useModelNumber = true; } else { modelNumber = getFloatEncodedInt(modelDotted); @@ -12189,7 +12188,7 @@ (tv.tok == T.varray ? SV.flistValue(tv, ((List<?>) tv.value) .size() == bs.cardinality() ? bs.cardinality() : viewer .getAtomCount()) : tv.asString()), BSUtil.copy(bs), - Integer.valueOf(tv.tok == T.varray ? 1 : 0), Boolean.FALSE }, + Integer.valueOf(tv.tok == T.varray ? 1 : 0) }, viewer.getAtomCount(), 0, 0, tv.tok == T.varray ? Integer.MAX_VALUE : Integer.MIN_VALUE, 0); return; Modified: trunk/Jmol/src/org/jmol/script/ScriptManager.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptManager.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/script/ScriptManager.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -27,7 +27,7 @@ import java.io.BufferedReader; import javajs.util.List; -import javajs.util.ParserJS; +import javajs.util.Parser; import javajs.util.SB; @@ -116,7 +116,7 @@ if (commandWatcherThread == null && useCommandWatcherThread) startCommandWatcher(true); if (commandWatcherThread != null && strScript.indexOf("/*SPLIT*/") >= 0) { - String[] scripts = ParserJS.split(strScript, "/*SPLIT*/"); + String[] scripts = Parser.split(strScript, "/*SPLIT*/"); for (int i = 0; i < scripts.length; i++) addScr(returnType, scripts[i], statusList, isScriptFile, isQuiet); return "split into " + scripts.length + " sections for processing"; Modified: trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -47,7 +47,7 @@ import javajs.util.M4; import javajs.util.P3; import javajs.util.P4; -import javajs.util.ParserJS; +import javajs.util.Parser; import org.jmol.util.Quaternion; import org.jmol.util.Txt; @@ -814,7 +814,7 @@ s = SV.sValue(x2); } s = Txt.simpleReplace(s, "\n\r", "\n").replace('\r', '\n'); - return addXAS(ParserJS.split(s, "\n")); + return addXAS(Parser.split(s, "\n")); case T.color: switch (x2.tok) { case T.string: Modified: trunk/Jmol/src/org/jmol/scriptext/ScriptExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/ScriptExt.java 2013-10-29 18:44:04 UTC (rev 18863) +++ trunk/Jmol/src/org/jmol/scriptext/ScriptExt.java 2013-10-29 18:44:21 UTC (rev 18864) @@ -84,14 +84,13 @@ import javajs.util.M4; import javajs.util.P3; import javajs.util.P4; -import javajs.util.ParserJS; +import javajs.util.Parser; +import javajs.util.V3; -import org.jmol.util.Parser; import org.jmol.util.Quaternion; import org.jmol.util.SimpleUnitCell; import org.jmol.util.TempArray; import org.jmol.util.Txt; -import javajs.util.V3; import org.jmol.viewer.FileManager; import org.jmol.viewer.JC; import org.jmol.viewer.ShapeManager; @@ -1271,7 +1270,7 @@ break; case T.boundbox: if (fullCommand.indexOf("# BBOX=") >= 0) { - String[] bbox = ParserJS.split(Parser.getQuotedAttribute( + String[] bbox = Parser.split(Parser.getQuotedAttribute( fullCommand, "# BBOX"), ","); pts = new P3[] { (P3) Escape.uP(bbox[0]), (P3) Escape.uP(bbox[1]) }; } else if (eval.isCenterParameter(i + 1)) { @@ -4193,22 +4192,8 @@ if (chk) return; boolean isDefault = (dataLabel.toLowerCase().indexOf("(default)") >= 0); - data = new Object[4]; - if (dataType.equals("element_vdw")) { - // vdw for now - data[0] = dataType; - data[1] = dataString.replace(';', '\n'); - int n = Elements.elementNumberMax; - int[] eArray = new int[n + 1]; - for (int ie = 1; ie <= n; ie++) - eArray[ie] = ie; - data[2] = eArray; - data[3] = Integer.valueOf(0); - viewer.setData("element_vdw", data, n, 0, 0, 0, 0); - return; - } if (dataType.equals("connect_atoms")) { - viewer.connect(Parser.parseFloatArray2d(dataString)); + viewer.connect(ParserBS.parseFloatArray2d(dataString)); return; } if (dataType.indexOf("ligand_") == 0) { @@ -4223,10 +4208,25 @@ dataString.trim()); return; } + data = new Object[4]; + // not saving this data in the state? + if (dataType.equals("element_vdw")) { + // vdw for now + data[0] = dataType; + data[1] = dataString.replace(';', '\n'); + int n = Elements.elementNumberMax; + int[] eArray = new int[n + 1]; + for (int ie = 1; ie <= n; ie++) + eArray[ie] = ie; + data[2] = eArray; + data[3] = Integer.valueOf(0); + viewer.setData("element_vdw", data, n, 0, 0, 0, 0); + return; + } if (dataType.indexOf("data2d_") == 0) { // data2d_someName data[0] = dataLabel; - data[1] = Parser.parseFloatArray2d(dataString); + data[1] = ParserBS.parseFloatArray2d(dataString); data[3] = Integer.valueOf(2); viewer.setData(dataLabel, data, 0, 0, 0, 0, 0); return; @@ -4234,12 +4234,12 @@ if (dataType.indexOf("data3d_") == 0) { // data3d_someName data[0] = dataLabel; - data[1] = Parser.parseFloatArray3d(dataString); + data[1] = ParserBS.parseFloatArray3d(dataString); data[3] = Integer.valueOf(3); viewer.setData(dataLabel, data, 0, 0, 0, 0, 0); return; } - String[] tokens = ParserJS.getTokens(dataLabel); + String[] tokens = Parser.getTokens(dataLabel); if (dataType.indexOf("property_") == 0 && !(tokens.length == 2 && tokens[1].equals("set"))) { BS bs = viewer.getSelectionSet(false); @@ -4256,17 +4256,17 @@ if (tokens.length == 3) { // DATA "property_whatever [atomField] [propertyField]" dataLabel = tokens[0]; - atomNumberField = javajs.util.ParserJS.parseInt(tokens[1]); - propertyField = javajs.util.ParserJS.parseInt(tokens[2]); + atomNumberField = javajs.util.Parser.parseInt(tokens[1]); + propertyField = javajs.util.Parser.parseInt(tokens[2]); } if (tokens.length == 5) { // DATA // "property_whatever [atomField] [atomFieldColumnCount] [propertyField] [propertyDataColumnCount]" dataLabel = tokens[0]; - atomNumberField = javajs.util.ParserJS.parseInt(tokens[1]); - atomNumberFieldColumnCount = javajs.util.ParserJS.parseInt(tokens[2]); - propertyField = javajs.util.ParserJS.parseInt(tokens[3]); - propertyFieldColumnCount = javajs.util.ParserJS.parseInt(tokens[4]); + atomNumberField = javajs.util.Parser.parseInt(tokens[1]); + atomNumberFieldColumnCount = javajs.util.Parser.parseInt(tokens[2]); + propertyField = javajs.util.Parser.parseInt(tokens[3]); + propertyFieldColumnCount = javajs.util.Parser.parseInt(tokens[4]); } } if (atomNumberField < 0) @@ -5183,7 +5183,7 @@ invArg(); } if (!chk) - showString(viewer.getDefaultVdwTypeNameOrData(0, vdwType)); + showString(viewer.getDefaultVdwNameOrData(0, vdwType, null)); return; case T.function: eval.checkLength23(); @@ -5353,7 +5353,7 @@ if (name.equals("/") && (len = slen) == 4) { name = parameterAsString(3).toLowerCase(); if (!chk) { - String[] info = ParserJS.split(viewer.getStateInfo(), "\n"); + String[] info = Parser.split(viewer.getStateInfo(), "\n"); SB sb = new SB(); for (int i = 0; i < info.length; i++) if (info[i].toLowerCase().indexOf(name) >= 0) @@ -5908,7 +5908,7 @@ } if (isProperty) viewer.setData(property2, new Object[] { property2, dataOut, bsOut, - Integer.valueOf(0) }, viewer.getAtomCount(), 0, 0, + Integer.valueOf(0), Boolean.TRUE }, viewer.getAtomCount(), 0, 0, Integer.MAX_VALUE, 0); else viewer.setAtomProperty(bsOut, tokProp2, 0, 0, null, dataOut, null); @@ -8054,7 +8054,7 @@ s += Escape.eBS(bs); } } - return mp.addXAS(ParserJS.split(s, sArg)); + return mp.addXAS(Parser.split(s, sArg)); case T.join: if (s.length() > 0 && s.charAt(s.length() - 1) == '\n') s = s.substring(0, s.length() - 1); @@ -8085,10 +8085,10 @@ int itab = (args[0].tok == T.string ? 0 : 1); String tab = SV.sValue(args[itab]); sList1 = (x1.tok == T.varray ? SV.listValue(x1) - : ParserJS.split(SV.sValue(x1), "\n")); + : Parser.split(SV.sValue(x1), "\n")); x2 = args[1 - itab]; sList2 = (x2.tok == T.varray ? SV.listValue(x2) - : ParserJS.split(SV.sValue(x2), "\n")); + : Parser.split(SV.sValue(x2), "\n")); sList3 = new String[len = Math.max(sList1.length, sList2.length)]; for (int i = 0; i < len; i++) sList3[i] = (i >= sList1.length ? "" : sList1[i]) + tab @@ -8129,9 +8129,9 @@ if (x1.tok == T.varray) { len = alist1.size(); } else { - sList1 = (ParserJS.split((String) x1.value, "\n")); + sList1 = (Parser.split((String) x1.value, "\n")); list1 = new float[len = sList1.length]; - ParserJS.parseFloatArrayData(sList1, list1); + Parser.parseFloatArrayData(sList1, list1); } if (isAll) { @@ -8153,9 +8153,9 @@ } else if (x2.tok == T.varray) { len = Math.min(len, alist2.size()); } else { - sList2 = ParserJS.split((String) x2.value, "\n"); + sList2 = Parser.split((String) x2.value, "\n"); list2 = new float[sList2.length]; - ParserJS.parseFloatArrayData(sList2, list2); + Parser.parseFloatArrayData(sList2, list2); len = Math.min(list1.length, list2.length); } @@ -8534,8 +8534,8 @@ } s = sb.toString(); float f; - return (Float.isNaN(f = ParserJS.parseFloatStrict(s)) ? mp.addXStr(s) : s - .indexOf(".") >= 0 ? mp.addXFloat(f) : mp.addXInt(javajs.util.ParserJS.parseInt(s))); + return (Float.isNaN(f = Parser.parseFloatStrict(s)) ? mp.addXStr(s) : s + .indexOf(".") >= 0 ? mp.addXFloat(f) : mp.addXInt(javajs.util.Parser.parseInt(s))); } private boolean evaluateData(SV[] args) { @@ -8560,7 +8560,8 @@ int iField = args[1].asInt(); int nBytes = args[2].asInt(); int firstLine = args[3].asInt(); - float[] f = ParserBS.extractData(selected, iField, nBytes, firstLine); + float[] f = ParserBS.parseFloatArrayFromMatchAndField(selected, null, 0, + 0, null, iField, nBytes, null, firstLine); return mp.addXStr(Escape.escapeFloatA(f, false)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |