input
stringlengths
10
828
output
stringlengths
5
107
public string wp html excerpt string str int count str strings strip tags str str qmultibyte mb strcut str 0 count remove part of an entity at the end str qreg ex perl preg replace s 0 6 str return str
safely extracts not more than the first count characters from html
public void close if file name equals we re reading from stdin don t do anything else try stream close catch ioexception e gaaa throw new runtime exception e
close the file stream and reset the file name
public energy particles atoms sim system sys this atoms atoms this sys sys size atoms number dim sim system dim parse interactions setup interactions
the energy class constructor
public void calc energy final int intlength interactions energy length for int i 0 i intlength i interactions energy i run
public void method calc energy calculates the bonded and non bonded forces br
public fdpoisson boltzmann eps grid particles atoms sim system sys this atoms atoms this sys sys size atoms number
the poisson boltzmannn eps grid class constructor
public fdpoisson boltzmann boundary particles atoms sim system sys super atoms sys false
the poisson boltzmann class constructor
public void update with final double value nn final double ss double nn 1 nn final double delta value nn av ss av delta av2 value delta
update the average with a sample value
public pairlist add offset final int offset for int ii 0 ii n particles ii for int jj 0 jj num pairs ii jj pairs ii jj offset return this
add an offset to the pairlist pairs
public particles insert final int pos final particles head subset bla range 0 pos final particles tail subset bla range pos number final particles insertion new particles 1 return head join insertion join tail
inserts a new particle at a specific position
public void write title final string title throws ioexception out file write author created by the esra md analysis package n out file write pdbtitle formatter format title out file flush
write more or less proper pdb header information author title
public sim system parse system sim system system new sim system do bonds bonds bonds new bonds bondblock size string tokenizer tok for int i 0 i bonds number i line string bondblock get i tok new string tokenizer line tok next token trim bonds i i integer parse int tok next token trim bonds j i integer parse int tok next token trim system bond bonds return system
parses system information from mol2 file into a sim system object
public string to string string string name description if required string string defaults to for int ii 0 ii default value length ii string default value ii string string n return string
convert argument to string
public void put argument description a throws ioexception if definitions contains key a type name throw new ioexception definitions already contain key a type name n definitions put a type name a
add another argument description
public string usage string us n usage progname n iterator string it definitions key set iterator while it has next us t argument description definitions get it next type to string us n return us
supply a usage string detailing program name
protected void check help hash map string array list string av throws ioexception if av contains key help system err print n help text for program progname n help text n usage system exit 0 else put new argument description new argument type spec help print the program help text and exit string null new argument value spec 0 0 argument checker no pattern
if the arguments contain the help keyword
protected void check values throws ioexception iterator string it definitions key set iterator while it has next string key it next array list string values available get key argument value spec avs argument description definitions get key values argument checker check key values avs min avs max avs pattern
assert that all the supplied arguments conform to the argument
public string read title final array list string block get next block if block size 0 throw new runtime exception no block found on file file name n final string first line string block get 0 if first line trim equals title throw new runtime exception next block in file file name is not a title block found first line n return string utils join string block sub list 1 block size 1 to array new string 0 n
gromos files are usually headed by a title block
public g96 frame read frame return read frame false
read and parse a gromos96 frame from file
public double fluctuation final double dd r avx av r avy av r avz av final double ff r dot av bla norm2 dd return ff
you shouldnt need this directly
public double gamma final double temperature final double rr constants rgas temperature r vol av constants eps0 return fluctuation rr
dont worry you shouldnt need this either
public jcomponent get toolbar return toolbar
get the jcomponent which represents the toolbar
public void new ui test ui ui test ui ui
uilistener interface method implementation
public list get seat list return seat list
return the list of seat ids as intuited from the locale files
public void reload debug info info m debug info info build ui false
reload the testbench
public void new ui test ui ui this ui ui
uilistener interface method implementation
public list get command list return command list
return the list of commands found in testbench
private void write message text string message message handler print message
wrapper function to print a message string
protected user agent create user agent define an anonymous class which customizes the handling of svg errors instead of popping up batik s standard ugly dialog box we pass the buck to our own handlers user agent agent new jsvgcanvas canvas user agent public void display error string msg svgtest canvas this message handler print msg public void display error exception ex svgtest canvas this error handler error ex return agent
override the creation of a user agent
public void set all enabled boolean val m start game but set enabled val m end game but set enabled val m seat popup set enabled val for int ix 0 ix m components size ix jcomponent cmp jcomponent m components get ix cmp set enabled val
turn all the controls in the buttonbar on or off
public void force redraw do nothing
kludge to force the component to redraw itself
protected void reload ui build ui pack repaint 0 0 999 999
rebuild the contents of the window because the metadata has changed
public metadata load metadata try return metadata parse svgmetadata base url catch exception ex error handler error ex return new metadata
implementation of test ui
public void set crashed m crashed true m table null
the client can notice in several ways that the game has crashed
public void set message handler game ui message handler message handler this message handler message handler
this is a grody hack to get a message handler into the referee
public void send message string message throws xmppexception get connection create chat get responder jid send message message
send a text message to the referee
public object construct try object res if m query type query info if m node null res m disco man discover info m jid else res m disco man discover info m jid m node else if m node null res m disco man discover items m jid else res m disco man discover items m jid m node return res catch xmppexception ex return ex
internal thread handler
public void finished object obj get if obj instanceof xmppexception m callback run null xmppexception obj m rock else m callback run iq obj null m rock
internal thread handler
public string get ver return m ver
return the ver attribute
public string get ext as string if m ext null m ext length 0 return null string buffer buf new string buffer for int ix 0 ix m ext length ix a space separated list if ix 0 buf append buf append string m ext ix return buf to string
return the extensions attribute in the form of a space delimited list
public boolean has ext string string val if m ext null m ext length 0 return false for int ix 0 ix m ext length ix string ext string m ext ix if ext equals val return true return false
returns whether the extensions attribute contains the given string
public void begin script code synchronized call in progress lock if call in progress boolean true throw new assertion error tried to run two ecmascript calls at the same time call in progress boolean true
this exists only to support assertions and paranoia checks
public data form get form return m form
get the data form
public string get form type form field field get field form type if field null field get type null field get type equals form field type hidden string formtype string field get values next return formtype return null
get the type the form type that is of the data form
public iterator get fields return m form get fields
return the fields of the data form
public string to xml string buffer buf new string buffer buf append append get element name buf append xmlns append get namespace append buf append buf append m form to xml buf append append get element name buf append return buf to string
generate xml for this extension
public void end script code synchronized call in progress lock call in progress boolean false
call this after executing any script code
public object construct try object res res m target invoke timeout m method name m params m timeout return res catch token failure ex return ex catch rpcexception ex return ex catch xmppexception ex return ex
internal thread handler
public void finished object obj get if obj instanceof exception m callback run null exception obj m rock else m callback run obj null m rock
internal thread handler
public boolean is success return m success
ask whether the query succeeded
public xmppexception get error return m error
extract the error that resulted from the query
public discover info get info return discover info m iq
extract the discover info that resulted from the query
public discover items get items return discover items m iq
extract the discover items that resulted from the query
protected void resolve object obj m worker get if obj null obj new xmppexception disco operation interrupted if obj instanceof xmppexception m success false m error xmppexception obj else m success true m iq iq obj
check out the workers result object and set the querys member
public object construct for int ix 0 ix m count ix query query m queries ix query m worker new disco worker m query type query for int ix 0 ix m count ix query query m queries ix query m worker start for int ix 0 ix m count ix query query m queries ix object result query m worker get return m queries
internal thread handler
public void finished resolve all the query results we do this after the worker threads have finished because it s less confusing this way for int ix 0 ix m count ix query query m queries ix query resolve m callback run m queries m rock
internal thread handler
protected void set required boolean val m required val
set whether this is a required seat
protected void add player player player if m players index of player 1 already there else m players add player
add a player to this seat
protected void remove player player player int index m players index of player if index 1 m players remove index else already gone
remove a player from this seat
public iterator get players return m players iterator
get the list of players sitting in this seat
public boolean is occupied if m players is empty return false else return true
is this seat occupied
protected void set active boolean val m active val
set whether this seat is active that is involved in the current
public string translate string token string tokens new string 1 tokens 0 token return translate arrays as list tokens
translate one token
public string translate string token1 string token2 string tokens new string token1 token2 return translate arrays as list tokens
translate a pair of tokens
public string get alt return m alt tag
get the alternate text string for this audio resource
public string translate token failure ex return translate ex get tokens
translate tokens received in an rpc failure message
public void set alt string alt if alt null alt m alt tag alt
set the alternate text string for this audio resource
public int get loop return m loop
get the looping factor for this audio resource
public void set loop int val if val 1 val loop continuously throw new illegal argument exception loop value must be positive or 1 m loop val
set the looping factor for this audio resource
public string translate seat id string token if locale dir null map tab get current table seat if tab contains key token return string tab get token return null
translate a seat identifier
public bookkeeper xmppconnection connection string jid super connection jid this jid jid
connect to a volity bookkeeper
public void stop if m clip null m clip stop
stop the clip
public void clear cache table cache game clear table cache ui clear table cache seat clear
clear the cached tables we loaded from the ui package
public void set current seat string seat id current seat seat id
set where the imaginary client thinks its sitting
public void change locale dir file locale dir this locale dir locale dir clear cache
switch to a different locale directory
protected boolean call ui scriptable obj string name list params if obj null game ui null game ui scope null return false object method obj get name game ui scope if method null method instanceof function no ui method is the same as a no op return false game ui call uimethod function method params new game ui completion public void result object obj drop the return value on the floor public void error exception ex game ui error handler error ex return true
utility function to call a named method of an object
public void get rulesets final callback callback object rock disco background callback subback new disco background callback public void run iq result xmppexception err object rock if err null callback run null err rock return assert result null result instanceof discover items discover items items discover items result list rulesets new array list for iterator it items get items it has next discover items item item discover items item it next rulesets add uri create string item get node callback run rulesets null rock disco background query new disco background get connection subback disco background query items jid rulesets rock
ask the bookkeeper what rulesets are available
public void connect return
this method is supposed to connect to the urls resource
protected list massage token list object args list ls new array list for int ix 0 ix args length ix object obj args ix if obj instanceof string ok as is else if obj instanceof number obj literal string value of obj else if obj null obj literal null else obj literal unprintable object obj to string ls add obj return ls
a couple of javascript accessible functions message and localize take
public void add invitation listener invitation listener listener listeners add listener
add a game table invitation listener
public void remove invitation listener invitation listener listener listeners remove listener
remove a game table invitation listener
public void start responder start
start listening for invitations
public void stop responder stop
stop listening for invitations
public void inject invitation invitation invitation for iterator it listeners iterator it has next invitation listener it next invitation received invitation
take an invitation that was pulled from some other source e
protected string prettify params object args string buffer buf new string buffer string methname args 0 to string if methname index of 0 methname game methname buf append methname buf append for int ix 1 ix args length ix if ix 1 buf append object obj args ix prettify param buf obj buf append return buf to string
convert a list of arguments for rpc into a string
public list get client types list types new array list form field field form get field client type if field null return types for iterator it field get values it has next try types add new uri string it next catch urisyntax exception e return types
get the client types supported by this game ui
public list get languages list langs new array list form field field form get field languages if field null return langs for iterator it field get values it has next langs add it next return langs
get the languages supported by this game ui
public uri get ruleset return uri create get value ruleset
get the ruleset supported by this game ui
public int get reputation string val get value reputation if val null return 0 return integer parse int val
get the reputation ranking of this game ui
public boolean matches version spec spec if spec null return true the code that does this check lives in version spec so we call that return spec matches this
check whether this version matches the given spec
public string get contact email return get value contact email
get the email address of the person responsible for this game ui
public string get contact jid return get value contact jid
get the jid of the person responsible for this game ui
public string to string if m string form null m string form string value of m major if is minor visible m string form string value of m minor if m release null m string form m release return m string form
return the string form of the version number
public string get description return get value description
get the description of this game ui
public string get content type try return get location open connection get content type catch ioexception e return null
get the media type of the content of this game ui
protected string get value string name form field field form get field name if field null return null return field get values next to string
get the value of a text single field
public string to string string s name name n location location n for iterator it form get fields it has next form field field form field it next s field get variable boolean first true for iterator it2 field get values it2 has next if first first false else s s it2 next s n s content type get content type return s
a human readable representation of the information for this game ui
public string get game name return m game name
the non internationalized game name
public boolean matches version number version if m patterns null matches anything return true must match at least one pattern for int ix 0 ix m patterns length ix if m patterns ix matches version return true nope return false
does this spec match the given version
public string to string if m string form null m string form for int ix 0 ix m patterns length ix if ix 0 m string form m string form m patterns ix to string return m string form
return the string form of the version spec
public string get player jid return string fields get player
the jid of the inviting player