Package org.jmol.script

Examples of org.jmol.script.ScriptVariable


    Enumeration e = htVariables.keys();

    String[] list = new String[htVariables.size()];
    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      ScriptVariable var = (ScriptVariable) htVariables.get(key);
      if (withSites || (!key.startsWith("@site_") && !key.startsWith("site_")))
        list[n++] = key
            + (key.charAt(0) == '@' ? " " + ScriptVariable.sValue(var) : " = "
                + varClip(key, var.escape(), nMax));
    }
    Arrays.sort(list, 0, n);
    for (int i = 0; i < n; i++)
      if (list[i] != null)
        appendCmd(sb, list[i]);
View Full Code Here


    ScriptVariable getOrSetNewVariable(String name, boolean doSet) {
      if (name == null || name.length() == 0)
        name = "x";
      Object v = getParameter(name, true);
      return (v == null && doSet && name.charAt(0) != '_' ?
        setUserVariable(name, new ScriptVariable())
         : ScriptVariable.getVariable(v));
    }
View Full Code Here

      if (htBooleanParameterFlags.containsKey(name))
        return htBooleanParameterFlags.get(name);
      if (htPropertyFlagsRemoved.containsKey(name))
        return Boolean.FALSE;
      if (htUserVariables.containsKey(name)) {
        ScriptVariable v = (ScriptVariable) htUserVariables.get(name);
        return (asVariable ? v : ScriptVariable.oValue(v));
      }
      return null;
    }
View Full Code Here

    ScriptVariable[] args = new ScriptVariable[names.length];
    propertyName = names[0];
    int n;
    for (int i = 1; i < names.length; i++) {
      if ((n = Parser.parseInt(names[i])) != Integer.MIN_VALUE)
        args[i] = new ScriptVariable(Token.integer, n);
      else
        args[i] = new ScriptVariable(Token.string, names[i]);
    }
    return extractProperty(getProperty(viewer, null, propertyName, propertyValue), args, 1);
  }
View Full Code Here

  public static Object extractProperty(Object property, ScriptVariable[] args, int ptr) {
    if (ptr >= args.length)
      return property;
    int pt;
    ScriptVariable arg = args[ptr++];
    switch (arg.tok) {
    case Token.integer:
      pt = ScriptVariable.iValue(arg) - 1//one-based, as for array selectors
      if (property instanceof List) {
        List v = (List) property;
View Full Code Here

    if (key.equalsIgnoreCase("frank"))
      return getShowFrank();
    if (key.equalsIgnoreCase("showSelections"))
      return modelSet.getSelectionHaloEnabled();
    if (global.htUserVariables.containsKey(key)) {
      ScriptVariable t = global.getUserVariable(key);
      if (t.tok == Token.on)
        return true;
      if (t.tok == Token.off)
        return false;
    }
View Full Code Here

        && (global.htBooleanParameterFlags.containsKey(key) || global.htPropertyFlagsRemoved
            .containsKey(key))) {
      // setPropertyError(GT._(
      // "ERROR: cannot set boolean flag to string value: {0}", key));
    } else {
      global.setUserVariable(key, new ScriptVariable(Token.string, value));
    }
  }
View Full Code Here

      global.setParameterValue(key, value);
    else if (!found && global.htBooleanParameterFlags.containsKey(key)) {
      // setPropertyError(GT._(
      // "ERROR: cannot set boolean flag to numeric value: {0}", key));
    } else {
      global.setUserVariable(key, new ScriptVariable(Token.decimal, new Float(
          value)));
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.jmol.script.ScriptVariable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.