org.jmol.script
Class ScriptVariable

java.lang.Object
  extended by org.jmol.script.Token
      extended by org.jmol.script.ScriptVariable

public class ScriptVariable
extends Token


Nested Class Summary
protected  class ScriptVariable.Sort
           
 
Field Summary
private static int FLAG_CANINCREMENT
           
private static int FLAG_LOCALVAR
           
private  int flags
           
 int index
           
private  java.lang.String myName
           
private static javax.vecmath.Point3f pt0
           
(package private) static ScriptVariable vAll
           
private static ScriptVariable vF
           
private static ScriptVariable vT
           
 
Fields inherited from class org.jmol.script.Token
abs, absolute, acos, add, addhydrogens, adjust, adpmax, adpmin, align, all, allconnected, allfloat, allowembeddedscripts, allowgestures, allowkeystrokes, allowmodelkit, allowmoveatoms, allowmultitouch, allowrotateselected, altloc, ambientpercent, amino, andequals, angle, angstroms, animation, animationfps, anisotropy, antialiasdisplay, antialiasimages, antialiastranslucent, append, appendnew, appletproxy, applysymmetrytobonds, arc, area, aromatic, array, arrow, as, assign, astrType, atomExpressionCommand, atomicorbital, atomid, atomindex, atomname, atomno, atompicking, atomproperty, atoms, atomtype, atomtypes, atomx, atomy, atomz, auto, autobond, autofps, average, axes, axescolor, axesmode, axesmolecular, axesorientationrasmol, axesscale, axesunitcell, axeswindow, axis, axis1color, axis2color, axis3color, axisangle, babel, babel21, back, backbone, background, backgroundcolor, backgroundmodel, backlit, barb, basepair, bin, binary, bind, bitset, blockdata, bondcount, bondmode, bondmodeor, bondorder, bondpicking, bondradiusmilliangstroms, bonds, bondset, bondtolerance, booleanparam, bottom, boundbox, boundboxcolor, branch, breakcmd, calculate, cameradepth, cancel, cap, carbohydrate, cartoon, cartoonbaseedges, cartoonrockets, casecmd, catchcmd, cavity, cd, cell, center, centerAt, chain, chaincasesensitive, check, chemical, circle, clash, clear, clickable, clipboard, col, collapsed, colon, color, colorrasmol, colorscheme, comma, command, commands, comparator, compare, configuration, connect, connected, console, constraint, contact, continuecmd, contour, contourlines, contours, coord, corners, cos, count, covalent, create, criterion, cross, crossed, currentlocalpath, curve, cutoff, cylinder, data, dataseparator, debug, debugscript, decimal, defaultanglelabel, defaultcmd, defaultcolorscheme, defaultdirectory, defaultdistancelabel, defaultdrawarrowscale, defaultlabelpdb, defaultlabelxyz, defaultlattice, defaultloadfilter, defaultloadscript, defaultON, defaults, defaultstructuredssp, defaulttorsionlabel, defaulttranslucent, defaultvdw, define, delay, delaymaximumms, delete, density, deprecatedparam, depth, diameter, diffusepercent, dipole, dipolescale, direction, disablepopupmenu, discrete, displacement, display, displaycellparameters, displayed, distance, distancefactor, div, divide, dna, dollarsign, dot, dotdensity, dots, dotscale, dotsselectedonly, dotsurface, dotted, downsample, dragselected, draw, drawhover, drawing, drawpicking, dssp, dsspcalchydrogen, dynamicmeasurements, eccentricity, echo, ed, edges, edsurlcutoff, edsurlformat, element, elemisono, elemno, ellipsoid, ellipsoidarcs, ellipsoidaxes, ellipsoidaxisdiameter, ellipsoidball, ellipsoiddotcount, ellipsoiddots, ellipsoidfill, elsecmd, elseif, end, endifcmd, energy, error, eta, exit, exitjmol, expression, expressionBegin, expressionEnd, facecenteroffset, file, filecachedirectory, filecaching, fill, filter, find, first, fixed, fixedtemp, flat, floatparam, floatproperty, flowCommand, font, fontcaching, fontscaling, fontsize, forceautobond, forcmd, formalcharge, format, fps, fractionalrelative, fracx, fracxyz, fracy, fracz, frame, frank, from, front, frontedges, frontlit, frontonly, full, fullplane, fullylit, function, functionxy, functionxyz, fux, fuxyz, fuy, fuz, geosurface, gestureswipefactor, getproperty, gotocmd, greyscalerendering, gridpoints, group, group1, groupid, groupindex, halo, hash, hbond, hbondsangleminimum, hbondsbackbone, hbondsdistancemaximum, hbondsrasmol, hbondssolid, helix, helix310, helixalpha, helixpi, helixstep, help, helppath, hermitelevel, hetero, hidden, hide, hidenameinpopup, hidenavigationpoint, hidenotselected, highlight, highresolution, history, historylevel, hkl, homo, hover, hoverdelay, hoverlabel, hydrogen, hydrophobic, id, identifier, identify, ifcmd, ignore, image, imagestate, implicitStringCommand, in, inchi, inchikey, increment, info, initialize, inline, insertion, insideout, integer, interior, intermolecular, internal, intersection, intparam, intproperty, intramolecular, intValue, invertSelected, ionic, isaromatic, iskiosk, isosurface, isosurfacekey, isosurfacepropertysmoothing, isosurfacepropertysmoothingpower, javascript, jmol, join, justifymeasurements, keys, label, language, languagetranslation, last, lattice, lcaocartoon, left, leftbrace, leftdivide, leftparen, leftsquare, legacyautobonding, length, lighting, line, linedata, lines, link, list, listf, load, loadatomdatatolerance, loadformat, loadligandformat, lobe, log, logcommands, logfile, loggestures, loglevel, lonepair, loop, lp, lumo, manifest, mapProperty, mass, mathExpressionCommand, mathfunc, mathop, mathproperty, matrix3f, matrix4f, max, maxset, measure, measureallmodels, measurementlabels, measurementnumbers, measurements, measurementunits, menu, mep, mesh, meshRibbon, message, messagestylechime, middle, min, minbonddistance, minimizationcriterion, minimizationrefresh, minimizationsilent, minimizationsteps, minimize, minmaxmask, minpixelselradius, minset, minus, minusMinus, misc, mlp, mo, mode, model, modelbased, modelindex, modelkitmode, modify, modifyorcreate, molecular, molecule, monitorenergy, monomer, mousedragfactor, mousewheelfactor, move, moveto, mrc, msms, mul, multiplebondradiusfactor, multiplebondspacing, multiprocessor, nada, name, navfps, navigate, navigatesurface, navigationdepth, navigationmode, navigationperiodic, navigationslab, navigationspeed, navx, navy, navz, nci, next, noArgs, nocontourlines, nocross, nodebug, nodots, noedges, nofill, nohead, noload, nomesh, none, noplane, normal, notfrontonly, notriangles, now, nucleic, obj, object, occupancy, off, offset, offsetside, omega, on, once, only, opAnd, opAND, opaque, opEQ, opGE, opGT, opIf, opLE, opLT, opNE, opNot, opOr, opToggle, opXor, orbital, orientation, origin, out, packed, palindrome, parallel, parameters, partialcharge, partialdots, path, pause, pdb, pdbaddhydrogens, pdbgetheader, pdbheader, pdbsequential, per, percent, percentvdwatom, period, perpendicular, perspectivedepth, perspectivemodel, phase, phi, phongexponent, picking, pickingspinrate, pickingstyle, picklabel, plane, play, playrev, plot, plot3d, plus, plusPlus, pmesh, pocket, point, point3f, point4f, pointgroup, pointgroupdistancetolerance, pointgrouplineartolerance, pointsperangstrom, polygon, polyhedra, polymer, polymerlength, pop, predefinedset, preservestate, prev, print, probe, process, prompt, property, propertyatomnumbercolumncount, propertyatomnumberfield, propertycolorscheme, propertydatacolumncount, propertydatafield, PROPERTYFLAGS, propselector, protein, psi, purine, push, pyrimidine, quaternion, quaternionframe, quit, rad, radical, radius, ramachandran, random, range, rangeselected, rasmol, redomove, reference, refresh, refreshing, remove, repaintwaitms, replace, reset, residue, resno, resolution, restore, restrict, resume, returncmd, reverse, reversecolor, rewind, ribbon, ribbonaspectratio, ribbonborder, right, rightbrace, rightparen, rightsquare, rna, rocket, rocketbarrels, rotate, rotate45, rotateSelected, rotation, rotationradius, row, rubberband, sasurface, save, saveproteinstructurestate, scale, scale3d, scaleangstromsperinch, script, scriptCommand, scriptqueue, scriptreportinglevel, search, select, selectallmodels, selected, selectedfloat, selecthetero, selecthydrogen, selection, selectionhalos, semicolon, seqcode, sequence, set, setparam, settable, shape, shapeCommand, shapely, sheet, sheetsmoothing, show, showaxes, showboundbox, showfrank, showhiddenselectionhalos, showhydrogens, showkeystrokes, showmeasurements, showmultiplebonds, shownavigationpointalways, showscript, showunitcell, sidechain, sigma, sign, silent, sin, site, size, slab, slabbyatom, slabbymolecule, slabenabled, slabrange, smallmoleculemaxatoms, smartaromatic, smiles, smiles2dimageformat, smilesurlformat, solid, solvent, solventprobe, solventproberadius, sort, spacebeforesquare, spacefill, spacegroup, spec_alternate, spec_atom, spec_chain, spec_model, spec_model2, spec_name_pattern, spec_resid, spec_seqcode, spec_seqcode_range, specialposition, specular, specularexponent, specularpercent, specularpower, sphere, spin, spine, spinfps, spinx, spiny, spinz, split, sqrt, squared, ssbond, ssbondsbackbone, star, state, statusreporting, stddev, step, stereo, stereodegrees, stop, straightness, strandcount, strandcountformeshribbon, strandcountforstrands, strands, string, strparam, strproperty, strucid, strucno, structure, strutdefaultradius, strutlengthmaximum, struts, strutsmultiple, strutspacing, sub, subset, substructure, sum, sum2, supercell, surface, surfacedistance, switchcmd, symbol, symmetry, symop, sync, syncmouse, syncscript, temperature, testflag1, testflag2, testflag3, testflag4, theta, thismodel, ticks, timeout, times, timestimes, title, titleformat, to, togglelabel, tok, tokenAll, tokenAnd, tokenAND, tokenAndFALSE, tokenArraySelector, tokenArraySquare, tokenColon, tokenComma, tokenConnected, tokenCoordinateBegin, tokenCoordinateEnd, tokenDefineString, tokenDivide, tokenEquals, tokenExpressionBegin, tokenExpressionEnd, tokenIf, tokenLeftParen, tokenMinus, tokenOff, tokenOn, tokenOpIf, tokenOr, tokenOrTRUE, tokenPlus, tokenRightBrace, tokenRightParen, tokenScript, tokenSet, tokenSetArray, tokenSetCmd, tokenSetProperty, tokenSetVar, tokenSpaceBeforeSquare, tokenSwitch, tokenTimes, top, torsion, trace, tracealpha, trajectory, transform, translate, translateSelected, translation, translucent, triangles, trim, trycmd, type, unaryMinus, unbind, undo, undomove, unitcell, unitcellcolor, unitx, unitxyz, unity, unitz, url, usearcball, useminimizationthread, usenumberlocalization, user, usercolorscheme, val, valence, value, vanderwaals, var, variable, variables, varray, vector, vectorscale, vertices, vibration, vibrationperiod, vibrationscale, vibx, vibxyz, viby, vibz, visible, visualrange, volume, w, waitformoveto, whilecmd, width, windowcentered, wireframe, wireframerotation, within, write, x, xyz, y, z, zap, zdepth, zerobasedxyzrasmol, zoom, zoomenabled, zoomlarge, zoomTo, zshade, zshadepower, zslab
 
Constructor Summary
ScriptVariable()
           
ScriptVariable(java.util.BitSet bs, int index)
           
ScriptVariable(int tok)
           
ScriptVariable(int tok, int intValue)
           
ScriptVariable(int tok, int intValue, java.lang.Object value)
           
ScriptVariable(int tok, java.lang.Object value)
           
ScriptVariable(Token x)
           
 
Method Summary
static boolean areEqual(ScriptVariable x1, ScriptVariable x2)
           
 boolean asBoolean()
           
 float asFloat()
           
 int asInt()
           
 java.lang.String asString()
           
static java.util.BitSet bsSelect(ScriptVariable var)
           
static java.util.BitSet bsSelect(Token x)
           
static java.util.BitSet bsSelectRange(Token x, int n)
           
static boolean bValue(Token x)
           
 boolean canIncrement()
           
static ScriptVariable concatList(ScriptVariable x1, ScriptVariable x2, boolean asNew)
           
 java.lang.String escape()
           
static float[] flistValue(Token x, int nMin)
           
static float fValue(Token x)
           
static java.util.BitSet getBitSet(ScriptVariable x, boolean allowNull)
           
static ScriptVariable getBoolean(boolean value)
           
 java.util.List<ScriptVariable> getList()
           
 java.lang.Object getValAsObj()
           
static ScriptVariable getVariable(java.lang.Object x)
           
 boolean increment(int n)
           
static ScriptVariable intVariable(int intValue)
           
static boolean isVariableType(java.lang.Object x)
           
static int iValue(Token x)
           
static java.lang.String[] listValue(Token x)
           
 ScriptVariable mapValue(java.lang.String key)
           
static java.lang.Object nValue(Token x)
           
static java.lang.Object oValue(ScriptVariable x)
           
static javax.vecmath.Point4f pt4Value(ScriptVariable x)
           
static javax.vecmath.Point3f ptValue(ScriptVariable x)
           
static ScriptVariable selectItem(ScriptVariable var)
           
static ScriptVariable selectItem(ScriptVariable var, int i2)
           
static Token selectItem(Token var)
           
static Token selectItem(Token tokenIn, int i2)
           
 ScriptVariable set(ScriptVariable v, boolean asCopy)
          creates a NEW version of the variable
 ScriptVariable setGlobal()
           
 ScriptVariable setName(java.lang.String name)
           
 boolean setSelectedValue(int selector, ScriptVariable var)
           
static int sizeOf(Token x)
           
 ScriptVariable sortOrReverse(int arrayPt)
           
static java.lang.String sprintf(ScriptVariable[] args)
          sprintf accepts arguments from the format() function First argument is a format string.
static java.lang.Object sprintf(java.lang.String strFormat, ScriptVariable var)
           
private static java.lang.String sprintf(java.lang.String strFormat, ScriptVariable var, java.lang.Object[] of, int[] vd, float[] vf, double[] ve, boolean getS, boolean getP)
           
static java.lang.String sValue(Token x)
           
private static void sValueArray(java.lang.StringBuffer sb, ScriptVariable vx, java.util.Map<java.lang.Object,java.lang.Boolean> map, int level, boolean isEscaped)
           
 void toArray()
           
private static float toFloat(java.lang.String s)
           
 java.lang.String toString()
           
static java.lang.String typeOf(ScriptVariable x)
           
static java.util.BitSet unEscapeBitSetArray(java.util.ArrayList<ScriptVariable> x, boolean allowNull)
           
 boolean unEscapeBitSetArray(java.util.BitSet bs)
           
static java.lang.Object unescapePointOrBitsetAsVariable(java.lang.Object o)
           
 
Methods inherited from class org.jmol.script.Token
addToken, completeCommand, getAtomPropertiesLike, getCommandSet, getMaxMathParams, getParamType, getPrecedence, getSettableTokFromString, getTokenFromName, getTokensLike, getTokFromName, intToken, nameOf, tokAttr, tokAttrOr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vT

private static final ScriptVariable vT

vF

private static final ScriptVariable vF

vAll

static final ScriptVariable vAll

index

public int index

FLAG_CANINCREMENT

private static final int FLAG_CANINCREMENT
See Also:
Constant Field Values

FLAG_LOCALVAR

private static final int FLAG_LOCALVAR
See Also:
Constant Field Values

flags

private int flags

myName

private java.lang.String myName

pt0

private static final javax.vecmath.Point3f pt0
Constructor Detail

ScriptVariable

public ScriptVariable()

ScriptVariable

public ScriptVariable(int tok)

ScriptVariable

public ScriptVariable(int tok,
                      int intValue,
                      java.lang.Object value)

ScriptVariable

public ScriptVariable(int tok,
                      java.lang.Object value)

ScriptVariable

public ScriptVariable(int tok,
                      int intValue)

ScriptVariable

public ScriptVariable(java.util.BitSet bs,
                      int index)

ScriptVariable

public ScriptVariable(Token x)
Method Detail

typeOf

public static java.lang.String typeOf(ScriptVariable x)

sizeOf

public static int sizeOf(Token x)

intVariable

public static ScriptVariable intVariable(int intValue)

isVariableType

public static boolean isVariableType(java.lang.Object x)

getVariable

public static ScriptVariable getVariable(java.lang.Object x)
Parameters:
x -
Returns:
a ScriptVariable of the input type, or if x is null, then a new ScriptVariable, or, if the type is not found, a string version

set

public ScriptVariable set(ScriptVariable v,
                          boolean asCopy)
creates a NEW version of the variable

Parameters:
v -
asCopy - create a new set of object pointers for an array; copies an associative array
Returns:
new ScriptVariable

setName

public ScriptVariable setName(java.lang.String name)

setGlobal

public ScriptVariable setGlobal()

canIncrement

public boolean canIncrement()

increment

public boolean increment(int n)

asBoolean

public boolean asBoolean()

asInt

public int asInt()

asFloat

public float asFloat()

asString

public java.lang.String asString()

getValAsObj

public java.lang.Object getValAsObj()

oValue

public static java.lang.Object oValue(ScriptVariable x)
Parameters:
x -
Returns:
Object-wrapped value

nValue

public static java.lang.Object nValue(Token x)
Parameters:
x -
Returns:
numeric value -- integer or decimal

bValue

public static boolean bValue(Token x)

iValue

public static int iValue(Token x)

fValue

public static float fValue(Token x)

sValue

public static java.lang.String sValue(Token x)

sValueArray

private static void sValueArray(java.lang.StringBuffer sb,
                                ScriptVariable vx,
                                java.util.Map<java.lang.Object,java.lang.Boolean> map,
                                int level,
                                boolean isEscaped)

ptValue

public static javax.vecmath.Point3f ptValue(ScriptVariable x)

pt4Value

public static javax.vecmath.Point4f pt4Value(ScriptVariable x)

toFloat

private static float toFloat(java.lang.String s)

concatList

public static ScriptVariable concatList(ScriptVariable x1,
                                        ScriptVariable x2,
                                        boolean asNew)

bsSelect

public static java.util.BitSet bsSelect(Token x)

bsSelect

public static java.util.BitSet bsSelect(ScriptVariable var)

bsSelectRange

public static java.util.BitSet bsSelectRange(Token x,
                                             int n)

selectItem

public static ScriptVariable selectItem(ScriptVariable var)

selectItem

public static Token selectItem(Token var)

selectItem

public static ScriptVariable selectItem(ScriptVariable var,
                                        int i2)

selectItem

public static Token selectItem(Token tokenIn,
                               int i2)

setSelectedValue

public boolean setSelectedValue(int selector,
                                ScriptVariable var)

escape

public java.lang.String escape()

unescapePointOrBitsetAsVariable

public static java.lang.Object unescapePointOrBitsetAsVariable(java.lang.Object o)

getBoolean

public static ScriptVariable getBoolean(boolean value)

sprintf

public static java.lang.Object sprintf(java.lang.String strFormat,
                                       ScriptVariable var)

sprintf

private static java.lang.String sprintf(java.lang.String strFormat,
                                        ScriptVariable var,
                                        java.lang.Object[] of,
                                        int[] vd,
                                        float[] vf,
                                        double[] ve,
                                        boolean getS,
                                        boolean getP)

sprintf

public static java.lang.String sprintf(ScriptVariable[] args)
sprintf accepts arguments from the format() function First argument is a format string.

Parameters:
args -
Returns:
formatted string

toString

public java.lang.String toString()
Overrides:
toString in class Token

getBitSet

public static java.util.BitSet getBitSet(ScriptVariable x,
                                         boolean allowNull)

areEqual

public static boolean areEqual(ScriptVariable x1,
                               ScriptVariable x2)

sortOrReverse

public ScriptVariable sortOrReverse(int arrayPt)
Parameters:
arrayPt - 1-based or Integer.MIN_VALUE to reverse
Returns:
sorted or reversed array

unEscapeBitSetArray

public boolean unEscapeBitSetArray(java.util.BitSet bs)

unEscapeBitSetArray

public static java.util.BitSet unEscapeBitSetArray(java.util.ArrayList<ScriptVariable> x,
                                                   boolean allowNull)

listValue

public static java.lang.String[] listValue(Token x)

flistValue

public static float[] flistValue(Token x,
                                 int nMin)

toArray

public void toArray()

mapValue

public ScriptVariable mapValue(java.lang.String key)

getList

public java.util.List<ScriptVariable> getList()