input
stringlengths
10
828
output
stringlengths
5
107
public void register listener invalidatable listener if log is debug enabled log debug register listener registering listener listener for any key register listener any listener
registers an invalidation listener for any all key
public boolean unregister listener invalidatable listener boolean unregistered false for map entry string invalidation publisher entry cache get all cache entries entry set invalidation publisher publisher entry get value if publisher unregister listener listener if log is debug enabled log debug unregister listener unregistered listener listener for key entry get key unregistered true return unregistered
unregisters a listener from all publishers
public void invalidate string key if any equals key throw new illegal argument exception key is a reseved key if log is debug enabled log debug invalidate publishing invalidation request for key key get publisher key invalidate key also publish a notification to those listening on any key get publisher any invalidate key
publishes an invalidation notification to all listeners
public int get queue length return semaphore get queue length
returns the number of requests currently waiting to execute
private invalidation publisher get publisher string key try return cache get key catch exception ex this should never happen throw new error an unexpected error occurred while attempting to retrieve publisher ex
retrieve the invalidation publisher for the given key
public int get in use return semaphore get in use
returns the number of requests currently running
public context create context throws naming exception return new initial context
creates a jndi initial context
public ejbhome get remote home string jndi name class c throws service locator exception return ejbhome portable remote object narrow get jndi name c
looks up the ejb remote home interface for the given jndi name
public ejblocal home get local home string jndi name throws service locator exception return ejblocal home get jndi name
looks up the local ejb home interface for the given jndi name
private context create context throws naming exception properties properties naming context properties get cluster if properties null cluster null cluster length 0 throw new naming exception unable to find naming properties for cluster cluster return new initial context properties
creates a jndi initial context
public t get remote throws service locator exception remote exception return get remote default cluster
retrieves a remote reference to the session bean in any cluster
public t get local throws service locator exception return get entry get proxy
retrieves a remote reference to the session bean in any cluster
public t get remote string cluster throws service locator exception remote exception return get entry cluster get proxy
retrieves a remote reference to the session bean in the given cluster
public context create context throws naming exception properties properties naming context properties get cluster if properties null cluster null cluster length 0 throw new naming exception unable to find naming properties for cluster cluster return new initial context properties
creates a jndi initial context
public t get return ref get
retrieves the ejb reference
public rmiservice locator get throws service locator exception return locators index next
uses a round robin algorithm to get the next service locator
public rmiservice locator get set service locator exclude throws service locator exception todo fix this algorithm since all clients will end up at the same node after a service failure for rmiservice locator locator locators if exclude contains locator return locator throw new service locator exception object not available
returns a locator that is not in the exclude list
protected string generate xml document document string system id throws transformer exception transformer factory transformer factory transformer factory new instance transformer transformer transformer factory new transformer transformer set output property output keys method xml transformer set output property output keys encoding utf 8 transformer set output property output keys doctype system system id transformer set output property output keys indent yes domsource source new domsource document string writer sw new string writer stream result result new stream result sw transformer transform source result return sw to string
generate an xml string from the given xml document
public node role definition add node role node role definition node role def throws cluster config exception try return add definition node role definitions node role def catch duplicate definition exception ex throw new duplicate definition exception ex get id cannot define node role ex get id since there is already a node role using that name
this method adds a node role definition to the cluster configuration
public node group definition add node group node group definition node group def throws cluster config exception try return node group definition add definition node resolver definitions node group def catch duplicate definition exception ex throw new duplicate definition exception ex get id cannot define node group ex get id since there is already a node group using that name
this method adds a node group definition to the cluster configuration
public delegate definition add global delegate delegate definition delegate def throws cluster config exception if node resolver definitions contains key delegate def get target id throw new node resolver not found exception delegate def get target id unable to resolve target delegate def get target id from delegate id try return add definition global delegate definitions delegate def catch duplicate definition exception ex throw new duplicate definition exception ex get id cannot define global delegate ex get id since there is already a global delegate using that name
adds a global delegate definition to the cluster configuration
public delegate group definition add delegate group delegate group definition delegate group def throws cluster config exception try return delegate group definition add definition node resolver definitions delegate group def catch duplicate definition exception ex throw new duplicate definition exception ex get id cannot define delegate group ex get id since there is already a delegate group using that name
adds a delegate group definition to the cluster configuration
public properties create properties return new properties default property matcher id null default property matcher id to string null
creates a new properties object
public property create property string name return new property name
creates a new property for the given name using the default property matcher
public property create property string name string property matcher id throws cluster config exception if property matcher id null if property matcher defs contains key property matcher id throw new definition not found exception property matcher id unable to find property matcher property matcher id specified for property name return new property name property matcher id return new property name
creates a new property for the given name using the given property matcher
public cluster config definition create cluser config throws cluster config exception return create cluser config false
creates a new cluster configuration definition
public void validate throws cluster config exception validate false
validates the definition
private void check recipe received if get intent get action null if bites was started by clicking on a notification that a recipe was received load the new recipe into the database and cancel the notification if get intent get action content equals com captainfanatic bites received recipe get intent get action content equals intent action view show dialog dialog import
check the intent to see if bites was started on receiving a recipe
public void merge with property property if property name equals name writeable writeable property writeable setter element setter element null property setter element setter element getter element getter element null property getter element getter element
merges this property with another property of the same name
private void resolve type references for type type types values type resolve type references this
resolves any type references
public string get full name string builder sb new string builder 128 sb append this if parameters is empty sb append sb append joiner on join parameters sb append if super class names is empty sb append extends joiner on join super class names if interface names is empty sb append is interface extends implements joiner on join interface names return sb to string
returns name with types and inheritance if any
public void init screensaver context context get context component c context get component adapter new smarter jmol adapter viewer jmol viewer allocate viewer c adapter viewer eval string quiet load c program files folding home v1 work current xyz
screen saver initialisation
public void paint graphics g component c get context get component viewer set screen dimension c get size current size rectangle rect clip new rectangle g get clip bounds rect clip viewer render screen image g current size rect clip try thread sleep 500 catch interrupted exception e
paint the next frame
public void set debug boolean tf logger set log level tf logger level debug logger level info
set debugging on or off
public int find string pattern string smiles boolean is smarts boolean is all system out println find pattern in smiles is smarts is smarts is all is all last error null int ret 1 try smiles matcher sm new smiles matcher bit set result sm find pattern smiles is smarts is all if result null last error invalid smiles exception get last error ret result null 1 result length catch exception e e print stack trace catch error er er print stack trace return ret
when used for student answer checking the students response
public string get relationship string smiles1 string smiles2 return new smiles matcher get relationship smiles1 smiles2
compares two smiles strings
public string reverse chiralit string smiles return new smiles matcher reverse chirality smiles
reverse the chirality throughout a smiles string
private void get path history java util properties props jmol panel history file get properties if povray path label null string povray path props get property povray path system get property user home if povray path null povray path label set text povray path if save path label null string save path props get property povray save path system get property user home if save path null save path label set text save path
just recovers the path settings from last session
private void save history java util properties props new java util properties props set property povray path povray path label get text props set property povray save path save path label get text jmol panel history file add properties props
just saves the path settings from this session
public void save list for int i 0 i 10 i if files i null props set property recent files file i files i jmol panel history file add properties props
saves the list to the history file
protected action get action string cmd return commands get cmd
fetch the action that was created for the given
private jtool bar create toolbar toolbar new jtool bar string tool1 keys tokenize jmol resource handler get string x toolbar for int i 0 i tool1 keys length i if tool1 keys i equals toolbar add separator else toolbar add create tool tool1 keys i action handler implementation would go here toolbar add box create horizontal glue return toolbar
create the toolbar
public void run script string script j spec view frame run script now script
no queuing here called by main frame
protected jmenu bar create menubar jmenu bar mb new jmenu bar add normal menu bar mb the macros menu add macros menu bar mb the plugin menu if plugin manager null mb add plugin manager get menu the help menu right aligned mb add box create horizontal glue add help menu bar mb return mb
create the menubar for the app
public jmol app console interface get app console jmol viewer viewer used after reflection gets the class return new app console viewer null null
dont delete used by viewer after it gets the class by name
public void print printer job job printer job get printer job job set printable display if job print dialog try job print catch printer exception e logger error error while printing e
added print command so that it can be used by rasmol script handler
protected void link activated url url viewer show url url to string if url get protocol equals file viewer show url url to string return add to history this url this url url visit url
opens a web page in an external browser
protected void show atom set index int index boolean b set select slider if b set select slider select slider set value index slider calls back to really set the frame return try current index index int atom set index indexes index viewer eval string quiet frame viewer get model number dotted atom set index info label set text viewer get model name atom set index show properties viewer get model properties atom set index show auxiliary info viewer get model auxiliary info atom set index catch exception e if this fails ignore it
show an atom set from the indexes array
public void find frequency int index int increment int max index indexes length boolean found frequency false search till get to either end of found a frequency while index 0 index max index found frequency viewer model has vibration vectors indexes index index increment if found frequency show atom set index index true
have the viewer show a particular frame with frequencies
protected void show properties properties properties boolean need lf false properties text area set text if properties null enumeration e properties property names while e has more elements string property name string e next element if property name starts with continue skip the hidden ones properties text area append need lf n property name properties get property property name need lf true
shows the properties in the properties pane of the
protected void show auxiliary info map string object auxiliary info string separator properties text area set text after properties if auxiliary info null iterator string e auxiliary info key set iterator while e has next string key name e next if key name starts with continue skip the hidden ones won t show objects properly of course equivalent in java script is in jmol new js properties text area append separator key name auxiliary info get key name separator n
shows the auxiliary information in the properties pane of the
private void update button abstract button b string entry string script string ret new string entry object icon get entry icon ret entry ret 0 if icon null b set icon image icon icon if entry null b set text entry if script null b set action command script
update the button depending upon its type
protected void set check box value object item string what boolean tf check for check box script item what tf if what index of config 0 configuration selected what update configuration computed menu update model set computed menu return
1 set option set set option true or set set option false
public int get shape id from object name string object name if shapes null for int i jmol constants shape min special i jmol constants shape max mesh collection i if shapes i null shapes i get index from name object name 0 return i return 1
returns the shape type index for a shape object given the object name
public void set mode mouse int mode mouse if mode mouse jmol constants mouse none start hover watcher false
only none 1 is implemented it just stops the
public void fill sphere int diameter point3f center if diameter 0 return exporter fill sphere colix diameter center
fills a solid sphere
public void add properties properties properties enumeration object keys properties keys boolean modified false while keys has more elements string key string keys next element string value properties get property key modified add property key value save
adds the given properties to the history
public boolean add property string key string value boolean modified false object old value properties set property key value if value equals old value modified true return modified
adds the given property to the history
private boolean add window position string name point position boolean modified false if name null if position null modified add property jmol window name x position x modified add property jmol window name y position y return modified
adds the window position to the history
private boolean add window border string name point border boolean modified false if name null border null modified add property jmol window border name x border x modified add property jmol window border name y border y return modified
adds the window border to the history
private boolean add window size string name dimension size boolean modified false if name null if size null modified add property jmol window name w size width modified add property jmol window name h size height return modified
adds the window size to the history
private boolean add window visibility string name boolean visible boolean modified false if name null modified add property jmol window name visible visible return modified
adds the window visibility to the history
public void reposition window string name component window reposition window name window 10 10 true
uses the informations in the history to reposition the window
private void load if file null return try file input stream input new file input stream file properties load input input close catch ioexception ex system err println error loading history ex
loads properties from the history file
private void save if file null return try file output stream output new file output stream file properties store output header output close catch ioexception ex system err println error saving history ex
saves properties to the history file
protected void debug print final string string if debug system out println string
debug print utility
private void output mtl string data n mtl bytes data length try mtlbw write data catch ioexception ex todo ignore for now
write to the
private string get texture name short colix return k escape get hex color from rgb g3d get color argb or gray colix
returns the name to be used for the texture associated with the given
private void write transparent color int icolor crc reset int start pos byte pos write int4 6 byte pos byte pos write string t rns byte pos byte pos write int2 icolor 16 0x ff byte pos byte pos write int2 icolor 8 0x ff byte pos byte pos write int2 icolor 0x ff byte pos crc update png bytes start pos byte pos start pos crc value crc get value byte pos write int4 int crc value byte pos
write a png t rns chunk into the png bytes array
public jmol app console interface get app console jmol viewer viewer return new applet console viewer null
dont delete used by viewer after it gets the class by name
public boolean is antialiased return false
is full scene oversampling antialiasing in effect
public int get render width return g3d get render width
gets g3d width
public int get render height return g3d get render height
gets g3d height
private void output list tuple3f pts int n pts matrix4f m string prefix bit set bs valid for int i 0 i n pts i if bs valid null bs valid get i continue pt temp set pts i if m null m transform pt temp output prefix pt temp x pt temp y pt temp z n
create the v or vn list
private void output face1 int face int map int map2 output f for int i face output map null i map i current vertex origin map2 null i map2 i current normal origin output n
local implementation of output face used for no texture coordinates
private void output face2 int face int vt int map int map2 output f for int i face output map null i map i current vertex origin current texture origin vt map2 null i map2 i current normal origin output n
local implementation of output face used with texture coordinates
public boolean set colix short colix this colix colix g3d set colix colix return true
sets current color from colix color index
private int index lower float x int x max if is periodic x max 0 while x 0 x x max while x x max x x max return int x if x 0 return 0 int floor int x return floor x max x max floor
periodic grids should have val 0 val x max
private float assign value from gap color for kin string color float value color equals greentint 4f color equals blue 0 35f color equals sky 0 25f color equals sea 0 15f color equals green 0 0f color equals yellowtint 0 1f color equals yellow 0 2f color equals orange 0 3f color equals red 0 4f 0 5f return value v min value v max value float na n
c code gives these as value x
private void read extents int voxel vector index throws exception string tokens parser get tokens read line extents voxel vector index parse float tokens voxel vector index 1
read the extentx extenty extentz lines and cache them
public void reset for mapping boolean have surface if have surface state parameters state data read qm orbital type qm type unknown parameters null color density false mapped data min float max value intersection null func null points null origin null steps null volume data null
reset some parameters at the map keyword
public void render screen image jmol viewer viewer object g object size display render screen image viewer g size
legacy apps will use this
public string get measurement script string sep boolean with model index string str extra are needed because of the possible context symop 1 2 boolean as script sep equals for int i 1 i count i str i 1 sep get label i as script with model index return str
used by mouse manager and picking manager to build the script
public void process next measure measurement m float value m get measurement here s where we check vdw if radius data null m is in range radius data value return system out println escape escape array m get count plus indices measurement strings add m get string viewer str format units
if this is the client then this method is
protected int get bond count in model int model index int n 0 for int i bond count i 0 if bonds i atom1 model index model index n return n
for general use
public short get default mad from order int order return short bond is hydrogen order 1 order jmol edge bond strut 0 int viewer get strut default radius 2000 default covalent mad
when creating a new bond determine bond diameter from order
private boolean assign aromatic double bond bond int bond index bond index if bs aromatic single get bond index return false if bs aromatic double get bond index return true bs aromatic double set bond index if assign aromatic single bond atom1 bond index assign aromatic single bond atom2 bond index bs aromatic double clear bond index return false return true
try to assign aromaticdouble to this bond
private boolean assign aromatic single bond bond int bond index bond index if bs aromatic double get bond index return false if bs aromatic single get bond index return true bs aromatic single set bond index if assign aromatic double bond atom1 assign aromatic double bond atom2 bs aromatic single clear bond index return false return true
try to assign aromaticsingle to this bond
private boolean assign aromatic single atom atom int not bond index bond bonds atom bonds if bonds null assign aromatic single hetero atom return false for int i bonds length i 0 bond bond bonds i int bond index bond index if bond index not bond index bond is aromatic bs aromatic single get bond index continue if bs aromatic double get bond index assign aromatic single bond return false return true
n atoms with 3 bonds cannot also have a double bond
public void undelete atom int i atom model set atoms i atom valence 0
called from org
private void add type int imodel string type string types add type string atom set collection get atom set auxiliary info imodel spectrum types type if types null return atom set collection set atom set auxiliary info spectrum types types imodel string s add type all types type if s null all types s
sets an auxiliary info string to hnmr 13 cnmr or ir or ms
private void process data parameter bond types clear tokenizer get token peeked this data set name key length 6 key substring 5 if this data set name length 0 if atom set collection get current atom set index 0 note that there can be problems with multi data mm cif sets each with multiple models and we could be loading multiple files atom set collection new atom set else atom set collection set collection name this data set name logger debug key
initialize a new atom set
private string process chemical info string type throws exception if type equals name chemical name data tokenizer full trim data else if type equals structural formula this structural formula data tokenizer full trim data else if type equals formula this formula data tokenizer full trim data if logger debugging logger debug type data return data
reads some of the more interesting info
private void process symmetry space group name throws exception set space group name key equals symmetry space group name h m hm hall data
done by atom set collection reader
private void process cell parameter throws exception for int i cell param names length i 0 if is match key cell param names i set unit cell item i parse float data return
unit cell parameters two options so we use mod 6
public bit set get iterative models boolean allow jmol data bit set bs new bit set for int i 0 i model count i if allow jmol data is jmol data frame i continue if models i trajectory base index i bs set i return bs
only some models can be iterated through
protected void sort orbital coefficients int pointers now sort the coefficients as well for int i orbitals size i 0 map string object mo orbitals get i float coefs float mo get coefficients float sorted new float pointers length for int j 0 j pointers length j int k pointers j if k coefs length sorted j coefs k mo put coefficients sorted
sorts coefficients by atomic number for speed later
protected double scale slater int ex int ey int ez int er double zeta int el ex ey ez switch el case 0 s case 1 p ez 1 no need for ex ey ez in that case break a negative zeta means this is contracted so there are not as many molecular orbital coefficients as there are slaters for example an atom s s orbital might have one coefficient for a set of three slaters the contracted set return get slater const cartesian el er 1 math abs zeta el ex ey ez
perform implementation specific scaling
private void read scfdone throws exception atom set collection set atom set name line
interprets the scf done section
private void read symmetry throws exception string tokens get tokens read lines 3 atom set collection set atom set property for sets symmetry group name tokens tokens length 1 equivalent atom sets
read the symmetry information and set the property