input
stringlengths
10
828
output
stringlengths
5
107
public void set title string title if title null exam title txt set text title
set the name of the exam
private string get select comment if current question instanceof scquestion return rb program strings get string select 1 correct choice else if current question instanceof multiple choice question return rb program strings get string select all multiple choice question current question get correct choices count rb program strings get string correct choices else if current question instanceof fill blank question return rb program strings get string fill in your answer else this should not reach return
returns the select comment for the current question
public int get major version string mv string major version txt get text if mv string null mv string trim equals return 1 else return integer parse int mv string trim
returns major version of the exam
public void set major version int major version major version txt set text string value of major version
set major version of the exam
public int get minor version string mv string minor version txt get text if mv string null mv string trim equals return 1 else return integer parse int mv string trim
get minor version of the exam
public void set minor version int minor version minor version txt set text string value of minor version
set minor version of the exam
public int get max questions string max string questions txt get text if max string null max string trim equals return 1 else return integer parse int max string trim
returns max questions of the exam
public void set max questions int max questions questions txt set text string value of max questions
set max questions of the exam
public float get pass percentage string pass string pass percentage txt get text if pass string null pass string trim equals return 1 0f else return float parse float pass string trim
returns pass percentage of the exam
public void set duration int duration duration txt set text string value of duration
set the duration of the exam
public int get duration try return integer parse int duration txt get text catch exception e return 0
returns the duration of the exam
public void set pass percentage float pass percentage pass percentage txt set text string value of pass percentage
set pass percentage of the exam
public string get description return exam description txa get text
returns the description of the exam
public void set description string description exam description txa set text description
set the description of the exam
public string get author name return author name txt get text
returns the author name of the exam
public void set author name string author name author name txt set text author name
set the author name of the exam
public string get author email return author email txt get text
returns the author email of the exam
public void set author email string author email author email txt set text author email
set the author email of the exam
public string get author web page return url txt get text
returns the author email of the exam
public void set author web page string author web page url txt set text author web page
set the author web page of the exam
public string get author description return author description txa get text
returns the description of the author
public void set author description string description author description txa set text description
set the description of the author
public string get instructions return exam instructions get text
returns the exam instructions
public void set instructions string description exam instructions set text description
set the instructions for the exam
public void reset exam name txt set text exam title txt set text major version txt set text minor version txt set text questions txt set text pass percentage txt set text author name txt set text author email txt set text url txt set text author description txa set text exam description txa set text exam instructions set text sections info get section descriptions clear sections info get sections clear
reset the ui
public void show section action buttons boolean b sections info show action buttions b
show hide action buttions in sections
public string get auth config return auth conf
get the resource path to the jaas login configuration file to use
public void set auth config string auth conf this auth conf auth conf
set the resource path to the jaas login configuration file to use
protected void start service throws exception look for the auth conf as resource class loader loader thread current thread get context class loader url login config loader get resource auth conf if login config null log info using jaas auth config login config to external form config xmllogin config mbean mbean proxy get xmllogin config mbean class main security config server loaded domains config load config login config else log warn no auth config resource found
start the org
public void set base rate float base rate if type ereaction type bi base rate float base rate 0 001 convert litre to meter 3 base rate float base rate constants avogadro number times mole by n avog to get number of molecules if reactants 0 get id equals ignore case reactants 1 get id this base rate base rate 2 base rate needs to be doubled if the bimolecular reaction is between 2 species of the same type this base rate base rate else this base rate base rate
transforms m 1s 1 into m 3s 1 for bimolecular reactions
public void add partner set set surface set reaction partners add all set if reaction partners contains this reaction partners remove this
adds the parameter set to the set of reaction partners
public boolean is bonding reaction return bonding reaction
returns true if the reaction is a bonding reaction and false otherwise
public void adjust rotation axis angle4d orient switch type case membrane if orient y 1f orient y 1f orient x 0f orient z 0f return else orient angle 0f return case flat return case above return case below return case static orient angle 0f return default return
if the landscapes place any restrictions on the object orientation then
public void displace vector3d position new orientation current orientation new centre of mass position system err println displace this id system err println current centre of mass system err println new centre of mass this update cluster
displaces the cluster to the new position given in position
public void load xmlentries map map xml entries map for object o map key set system err println o system err println map get o get class template factory new template factory load infiles create parameters this sim sys set membrane position this get membrane position create randomizer system exit 666 create output create membrane domains create diffusion space create default diffusion create boundaries membrane domain map create creation laws create events create features create reactions create templates pair reactions
loads the map of xml entries into the factory so it can produce
public void setup simulation universe canvas3 d simulation canvas locale add branch graph create view branch simulation canvas locale add branch graph create content branch
sets up the simulation universe by creating the view graph and scene graph
public void save png buffered image image file outfile new file filename 105 6 123 48 encoder set param param try file output stream fos new file output stream out file capture post swap count png image encoder encoder image codec create image encoder png fos null encoder encode image fos close catch exception e e print stack trace file output file new file out file capture post swap count png try image io write image png output file catch ioexception e system err println unable to write to output file system err println please check pathname and permissions
method takes a filename and buffered image
public void save bmp string filename buffered image image file outfile new file filename file output stream fos create file outfile image encoder encoder image codec create image encoder bmp fos null bmpencode param param new bmpencode param encoder set param param try encoder encode image fos close catch exception e e print stack trace
method takes filename and buffered image
private void build unimolecular reaction ireactant x reaction r if x get template get class entity template class create unimolecular reaction x r for surface s entity x get reaction surface create unimolecular reaction s r bond b s get bond if b null create unimolecular reaction b r else if x get template get class reaction surface template class create unimolecular reaction x r bond b surface x get bond if b null create unimolecular reaction b r else if x get template get class bond template class create unimolecular reaction x r
creates unimolecular reactions for a reactant species
private void populate reaction lists map string reaction map set reaction bi new hash set reaction set reaction zero new hash set reaction set reaction uni new hash set reaction for reaction r map values r set system this switch r get type case bi bi add r break case uni uni add r register state effect r break case zero precompute zeroth order reactions r break default break bi molecular reactions new hash set reaction bi uni molecular reactions new hash set reaction uni zero orderreactions new hash set reaction zero
populates the three lists containing the 3 types of reactions that can
private void populate surface partner sets for string s reaction partners key set set surface p set surface template map get s if p set null continue for surface surface p set set string set1 reaction partners get s if set1 null continue for string str set1 set surface set2 surface template map get str if set2 null continue surface add partner set set2
populates the surface reaction partner sets for each surface
public void confirm create clusters set changed notify observers voxel set clear voxel copy clear voxel set new hash set integer voxel copy new hash map integer set integer
creates all the new clusters from the previous reactions and notifies
public void write object ob output stream out
write the json for the passed in object to out
public string get object ob field flds ob get class get declared fields string buffer ret new string buffer for int t 0 t flds length t ret append flds t ret append r n return ret to string
return the json for the passed in object as an inline string
public connection get conn try init catch exception e throw new runtime exception could not reconnect user factory connection e return conn
restarts connection if dead
public void init throws exception do nothing just avoiding the init call in super
connect or reconnect the factory to the database
public user get user user this user new stateless user this user set user field user user field this user set password field user password field this user set table name user table name this user set key col user ide field this user set factory this return this user
instantiates and returns a user object
public boolean is meme owner user u string resource boolean ret false return ret
implement this but how
public void set id int uid id uid
sets the id in memory does not commit to db
public boolean check access object target string permission return true
check access for an object
public boolean is anon return is anon
returns whether this is an anonymous user
public boolean commit throws login exception if succeeded false return false else add a principal authenticated identity to the subject assume the user we authenticated is the user user principal new user user principal set user name username if subject get principals contains user principal subject get principals add user principal if debug system out println t t sample login module added user to subject in any case clean out state username null for int i 0 i password length i password i password null commit succeeded true return true
p this method is called if the login contexts
public boolean is admin try for int t 0 t this groups length t object idx groups t get val id to string if idx equals acl entry admin group groups t to string equals administrator return true catch exception e return false
returns whether this is an admin user
public void set anon boolean is anon this is anon is anon
sets whether this is an anonymous user
public vdirectory list get directory string path string findpath path strip off one character of the path at a time and match it against aliases until it gets a hit we ll want to save hit paths in a hashtable for faster lookups while this contains data key alias findpath findpath length 0 findpath findpath substring 0 findpath length 1 return this find value alias findpath 1
get the virtual directory information for a given path
private group get everyone group if everyone null return everyone for int t 0 t groups length t if string value of groups t get group id equals acl entry everyone group everyone groups t return everyone
returns the everyone group
public persistence engine get factory persistence engine fct super get factory make sure the userfactory connection is ok if fct instanceof user factory try check factory db connection connection con user factory fct get conn statement stmt con create statement result set rs stmt execute query show tables catch exception e try retry init factory db connection user factory fct init catch exception ex logger log err user get factory failed user factory database connection error ex to string return fct
override get factory to check db connection liveliness
public void send to list get the message body subject and sender string sub this get string val 0 subject field bod this get string val 0 body field send this get string val 0 from field get the list of recipients string recps new string recips get num rows for int t 0 t recips get num rows t recps t recips get string val t email address field send the message this send recps sub bod send
using the field mappings we select a valid
public void init string recp sql recips set sql recp sql recips set key col email address field recips set factory this get factory try recips load catch java sql sqlexception e system out println error in list mailer bean e
just load recipient data from sql
public void init connection conn string table string optv string dbcs this mail settings dbcs listhash new hashtable if debug logger log info list serve init existing connection connection conn this recipient table table this opt in val optv
init list server using an existing connection
public string get password try string crypt cfg props get resource string password crypt shacrypter do crypt crypt return crypt catch exception e todo auto generated catch block logger log err serve get password failed to encrypt server password e return null
returns the sha 1 encrypted cluster server password
public string get session auth ticket string username string password get the encrypted server pass string ret this get password string combined username password get a time try return user factory crypt user pass combined ret catch exception ex logger log err serve get session auth ticket failed ex return null
returns a sha 1 encrypted cluster server password link that will
public map get group map java util map v new java util hash map for int i 0 i groups length i v put groups i to string groups i return v
get the group map
public list get group list java util vector v new java util vector for int i 0 i groups length i v add groups i return v
get the group list
public void svc send messages try connection close catch sqlexception e logger log err luminet list serve problem closing connection e
send the messages
public void add instance serve s user u
add a server instance to this cluster
public void remove instance serve s user u
remove a server instance from this cluster
private vector read file string fn http servlet response res file f new file fn if f exists try if this debug res send error http servlet response sc not found file not found fn else res send error http servlet response sc not found file not found fn logger log info jspprocessor read file file not found fn catch exception e system err println error sending http servlet response sc not found in jspprocessor e still couldn t find fn logger log info jspprocessor read file file not found fn return null else return read file fn
reads jsp file from filesystem
public void empty inuse empty available empty super clear
clear all entries
public boolean send data string data output stream out boolean data sent false data r n int len data length byte buffer new byte len buffer data get bytes try out write buffer data sent true catch java io ioexception e system out println dead host e return data sent
send a bit of data to the nice output stream
public void log string line boolean appendts if appendts log get log date line else log line
write a line to the server log file
public void dump java props to file properties p new properties p system get properties enumeration e p keys this log begin dump of java system properties true while e has more elements string s string e next element string t system get property s this log s t true this log end dump of java system properties true
utility method to dump current java properties to file
public void record save pulse check info pulse boolean okay int status level 0 if okay status level 1 string buffer recins new string buffer insert into pulsechecker log url id status level timestamp values recins append pulse url id recins append string value of status level recins append null try system out println recins to string statement stmt connection create statement stmt execute recins to string catch sqlexception e system out println error executing insert e
record the status of a pulse check
public void add types string nv serve logger log err warning unsupported method called mime map add types string
feed a comma delimited list of name value pairs for
public boolean check access user p string pm this to string pm pm substring 0 pm index of return p check access pm read
checks permissions of user to access this page
public boolean check access object target string permission user p return p check access target permission
checks permissions for user based on named resource
public boolean check access user p if p get num rows 1 return false acl acl p get acl if acl null return false string pm this to string pm pm substring 0 pm index of read com extentech security permission chckperm new com extentech security permission pm return acl check permission p chckperm
our standard security impl
public map get session map return sessions
get a handle to all sessions
public boolean check access object target string permission user p if p get num rows 1 return false acl acl p get acl if acl null return false string pm target to string permission com extentech security permission chckperm new com extentech security permission pm return acl check permission p chckperm
our standard security impl
public boolean in use if system current time millis created timeout return false if redirected return false if committed return false boolean retval true if the socket is still valid it s being used retval out null retval serve output stream out get flushed retval this headers written retval committed if debug serve log serve connection in use retval return retval
returns whether this object is in use
public void remove session string session id sessions remove session id
get a handle to a session from the active sessions
public int get num times reused return num times re used
returns the number of times
public void set dbparams hashtable args args hash args hasargs true for int i 0 i 4 i string val string args hash get string value of i switch i case 0 url val break case 1 driver val break case 2 user val break case 3 password val break
sets the database connection parameters
public void delete try this finalize catch throwable t system out println t
destroy this object and remove
public void dispatch page string rootdir string jsp page http servlet request request http servlet response response throws servlet exception ioexception if jsp page ends with jsp jsp page jsp if rootdir equals rootdir basedir if no dir specified then use default jsp page rootdir jsp page request dispatcher rd get servlet context get request dispatcher jsp page try rd forward request response catch servlet exception e throw new servlet exception file servlet dispatch page problem redirecting to jsp page catch null pointer exception a throw new servlet exception file servlet dispatch page problem redirecting to jsp page
handle sending the request to a page
public void increment counter val string str counter name object oby get counter val str counter name if oby null counters remove str counter name this set counter val str counter name new integer 1 return int itv 1 try itv integer parse int string value of oby itv catch exception ex log could not increment counter str counter name ex counters put str counter name new integer itv
increments a counter val
public void set counter val string str counter name object o counters put str counter name o
returns the servers performance counters
public void delete try this finalize catch throwable t
destroy this object and remove
public principal get user principal if principal null return principal if session null session luminet session this get session if session get attribute com extentech security user null principal principal session get attribute com extentech security user return principal principal
get the logged in user if it exists
public object get counter val string str counter name return counters get str counter name
returns the servers performance counters
public hashtable get counters update builtin counters return counters
returns the hashtable of performance counters
public int get max inactive interval this accessed return maxinactive
returns the maximum time interval in seconds that
public void set max inactive interval int max this accessed maxinactive max
sets the maximum time interval in seconds that
public void update counter string n object v if counters contains key n counters remove n counters put n v else counters put n v
sets the servers performance counters
public void set dbfile string file set database path 0 file
sets the path to the first database file
public void set port string port set port integer parse int port
sets the port the server listens on
public boolean is online return get state server configuration server state online
returns whether the server is in the online state
public boolean is opening return get state server configuration server state opening
returns whether the server is in the opening state
public string get serve setting string parmname if serve settings get num rows 0 return serve settings get string val 0 parmname return serve settings not initialized
retrieve a value for the serve instance
public boolean is closing return get state server configuration server state closing
returns whether the server is in the closing state