input
stringlengths
10
828
output
stringlengths
5
107
public string to adjacency matrix row list extends string seg names visibility 0 1 array int ncols seg names size int row array new int ncols for int n row array n 0 iterator string itr visibility iterator while itr has next string seg itr next int index seg names index of seg row array index 1 0 1 array string string row string for int n row array row string row string concat n concat remove the last extraneous and return return row string trim
generates a string of space separated 0s and 1s representing the
public boolean is parallel to line segment b return determinant b equals zero
tests if segments this and b are parallel
public boolean is colinear to line segment b first check parallel then use segment p1 p3 to check collinear return this is parallel to b this is parallel to new line segment this get vertex1 b get vertex1
t ests if segments this and b are collinear
public string to string return id this id n pass word this pass word n nick name this nick name n game points this game points n win this win n lose this lose n sign this sign n room state this room state n table state this table state n game state this game state n game client this client to string n
p return a string that describe the instance
public void add player list player info player info if this is full system out println else try this player list put player info get param player info p id player info player number catch runtime exception e system out println get param
p player list
public void delete player list player info player info try player list remove player info get param player info p id player number catch runtime exception e system out println get param
p player list
public void set client client mediator client this client client
p set the parameter client mediator
public void open final display display mainshell get display create contents shell open shell layout while shell is disposed if display read and dispatch display sleep system out println hello
open the window
protected void create contents shell new shell mainshell swt none shell set size 263 149 shell set text final label label new label shell swt none label set text label set bounds 32 35 180 17 final button button new button shell swt none button add mouse listener new mouse adapter public void mouse down final mouse event e shell dispose button set text button set bounds 95 70 50 27
create contents of the window
protected void create contents shell new shell mainshell shell set size 274 158 shell set text final label label new label shell swt none label set text label set bounds 30 42 190 17 final button button new button shell swt none button add mouse listener new mouse adapter public void mouse down final mouse event e shell dispose button set text button set bounds 99 85 50 27
create contents of the window
protected void create contents shell new shell mainshell get shell shell set size 253 154 shell set text final label label new label shell swt none label set text label set bounds 31 33 217 17 final button button new button shell swt none button add mouse listener new mouse adapter public void mouse down final mouse event e shell dispose registerpage get shell dispose new login manager registerpage get gm mainshell button set text button set bounds 88 69 50 27
create contents of the window
public void open final display display mainshell get display create contents shell open shell layout while shell is disposed if display read and dispatch display sleep
open the window
protected void create contents shell new shell mainshell shell set size 282 170 shell set text final label label new label shell swt none label set text label set bounds 32 43 200 17 final button button new button shell swt none button add mouse listener new mouse adapter public void mouse down final mouse event e shell dispose button set text button set bounds 101 79 50 27
create contents of the window
public void open display mainshell get display create contents shell open shell layout while shell is disposed disposed if shell get display read and dispatch shell get display read and dispatch shell dispose
open the window
public void open display new display create contents shell open shell layout while shell is disposed disposed if display read and dispatch display sleep shell dispose
open the window
protected void create contents shell new shell display swt close swt min shell set background image new image shell get display somepic menubg jpg shell set image new image shell get display constants logo file shell set background mode swt inherit default shell set size 800 625 shell set text magic point24 m controller new menu controller this m controller addcontents
create contents of the window
public void open display display get default create contents shell open shell layout while shell is disposed if shell get display read and dispatch shell get display sleep
open the window
public string to string return id this id n pass word this pass word n nick name this nick name n game points this game points n win this win n lose this lose n sign this sign n
p return a string that describe the instance
public hssfrow create row int src row num hssfsheet sheet wb get sheet at 0 int target row num sheet get last row num 1 return create row sheet sheet src row num target row num
src row num target row num
public hssfrow create row hssfsheet src sheet hssfsheet target sheet int src row num int target row num hssfrow src row src sheet get row src row num hssfrow new row target sheet create row target row num new row set height src row get height int i 0 for iterator cell cit src row cell iterator cit has next cell hssf cell cit next hssfcell cell hssfcell cell new row create cell i cell style s hssf cell get cell style cell set cell style hssf cell get cell style return new row
src row num target row num
protected object convert to string class type object value if value instanceof date date format df new simple date format get date pattern if value instanceof timestamp df new simple date format get date time pattern try return df format value catch exception e e print stack trace throw new conversion exception error converting date to string else return value to string
convert a java
public void service http servlet request request http servlet response response throws servlet exception ioexception request set attribute title request set attribute content strong strong request get request dispatcher forward test jsp forward request response
forward url redirect
public string get column name by pro name string pro name throws document exception return null
simplejee src com yuqiaotech simplejee xml simple sample
public char user auth info op packet string vertify code string cookie if user is logged in 08 auth info op packet packet new 08 auth info op packet user packet set sub command 08 qq qq sub cmd get auth info need vertify packet set sub sub command 08 qq qq sub sub cmd get friend auth info need vertify packet set friend qq get qq num packet set auth string vertify code packet set cookie cookie send packet packet return packet get sequence return 0
auth info op packet
public regex matcher get regex matcher return matcher
gets the current regex matching strategy
public void set regex matcher regex matcher matcher if matcher null throw new illegal argument exception regex matcher must not be null this matcher matcher
sets the current regex matching strategy
protected void register rule string pattern rule rule registered rules add new registered rule pattern rule
register a new rule instance matching the specified pattern
public void clear registered rules clear
clear all existing rule instance registrations
public list match string namespace uri string pattern not a particularly quick implementation regex is probably going to be slower than string equality so probably should have a set of strings and test each only once xxx fix me time and optimize array list rules new array list registered rules size iterator it registered rules iterator while it has next registered rule next registered rule it next if matcher match pattern next pattern rules add next rule return rules
finds matching rules by using current regex matching strategy
public void add rule instances org apache commons digester digester digester throws xml load exception add rule instances digester null
adds to the digester the set of rule instances defined in the
public list rules array list rules new array list registered rules size iterator it registered rules iterator while it has next rules add registered rule it next rule return rules
return a list of all registered rule instances or a zero length list
public attributes substitute attributes attributes attributes results attributes if attributes expander null variable attributes init attributes attributes expander results variable attributes return results
substitutes the attributes before they are passed to the
public void init attributes attrs variable expander expander this attrs attrs this expander expander i hope this doesn t release the memory for this array for efficiency this should just mark the array as being size 0 values clear
specify which attributes class this object is a proxy for
public string substitute string body text string result body text if body text expander null result body text expander expand body text return result
substitutes for the body text
public void set target digester d target digester d
sets the digester into which to add the parsed rules
public boolean is ignore missing property return this ignore missing property
p are attributes found in the xml without matching properties to be ignored
public void set ignore missing property boolean ignore missing property this ignore missing property ignore missing property
sets whether attributes found in the xml without matching properties
public void set base path string path if path null base path else if path length 0 path ends with base path path else base path path
set a base pattern beneath which all the rules loaded by this
public void add string pattern rule rule super add pattern rule counter order put rule new integer counter
register a new rule instance matching the specified pattern
public void set digester rules dtd string dtd url digester dtd url dtd url
sets the location of the digester rules dtd
public void set use exact match boolean use exact match this use exact match use exact match
set whether code method utils
protected string get digester rules dtd class loader class loader get class get class loader url url class loader get resource digester dtd path return url to string return digester dtd url
returns the location of the dtd used to validate the digester rules
public void set plugin class attribute string namespace uri string attr name plugin class attr ns namespace uri plugin class attr attr name
sets the xml attribute which the input xml uses to indicate to a
public rules get parent return parent
return the parent rules object
public void add rule rule target digester add rule base path pattern stack to string rule
adds a rule the the target digester
public void add declaration declaration decl log log log utils get logger null boolean debug log is debug enabled class plugin class decl get plugin class string id decl get id declarations by class put plugin class get name decl if id null declarations by id put id decl if debug log debug indexing plugin id id class plugin class get name
add the declaration to the set of known declarations
public declaration get declaration by class string class name declaration decl declaration declarations by class get class name if decl null parent null decl parent get declaration by class class name return decl
return the declaration object with the specified class
public declaration get declaration by id string id declaration decl declaration declarations by id get id if decl null parent null decl parent get declaration by id id return decl
return the declaration object with the specified id
public void set plugin id attribute string namespace uri string attr name plugin id attr ns namespace uri plugin id attr attr name
sets the xml attribute which the input xml uses to indicate to a
private void load input stream s throws ioexception byte array output stream baos new byte array output stream byte buf new byte 256 for int i s read buf if i 1 break baos write buf 0 i input baos to byte array
the contents of the input stream are loaded into memory and
public void add rules digester d string path throws plugin exception log log d get logger boolean debug log is debug enabled if debug log debug loader from class loading rules for plugin at path path try object params d path rules method invoke null params catch exception e throw new plugin exception unable to invoke rules method rules method on rules class rules class e
just invoke the target method
public void add rules digester digester string path log log digester get logger boolean debug log is debug enabled if debug log debug loader set properties loading rules for plugin at path path digester add set properties path
just add a set properties rule at the specified path
public void set digester digester digester this digester digester decorated rules set digester digester
set the digester instance with which this rules instance is associated
public rule loader find loader digester d class plugin class properties p string state p get property props attr if state null state equals falseval user has explicitly disabled automatic setting of properties this is not expected to be common but allowed return null return new loader set properties
returns a rule loader i unless i the properties contain an entry
public string get namespace uri return decorated rules get namespace uri
return the namespace uri that will be applied to all subsequently
private list find exact ancester match string parent pattern list matching rules null int last index parent pattern length while last index 0 last index parent pattern last index of last index if last index 0 matching rules list this cache get parent pattern substring 0 last index if matching rules null return matching rules return null
finds an exact ancester match for given pattern
public void set namespace uri string namespace uri decorated rules set namespace uri namespace uri
set the namespace uri that will be applied to all subsequently
public void set properties properties p properties put all p
copy all key value pairs in the param into the properties member of
public void set rule finders list rule finders this rule finders rule finders
set the list of rule finder objects
public class get plugin class return plugin class
return plugin class associated with this declaration
public string get plugin class attr ns return plugin class attr ns
get the namespace for the xml attribute which indicates to a
public void set digester digester digester super set digester digester log digester get logger
invoked when rule is added to digester
public string get plugin class attr return plugin class attr
get the namespace for the xml attribute which indicates to a
public void set trim data boolean trim data this trim data trim data
when set to true any text within child elements will have leading
public string get plugin id attr ns return plugin id attr ns
get the namespace for the xml attribute which indicates to a
public rules factory get rules factory return rules factory
return the rules factory object or null if one has not been specified
public string get plugin id attr return plugin id attr
get the namespace for the xml attribute which indicates to a
public void begin attributes attributes throws exception the path attribute gives the uri to another digester rules xml file string file name attributes get value path if file name null file name length 0 include xmlrules file name the class attribute gives the name of a class that implements the digester rules source interface string class name attributes get value class if class name null class name length 0 include programmatic rules class name
to include a rules xml file we instantiate another digester and
public void set rules factory rules factory factory rules factory factory
set the object which is used to generate the new rules instances created
public void set allow unknown child elements boolean allow unknown child elements this allow unknown child elements allow unknown child elements
determines whether an error is reported when a nested element is
public list rules return decorated rules rules
return the list of rules registered with this object in the order
public void clear decorated rules clear
clear all rules
public list match string path return match null path
return a list of all registered rule instances that match the specified
public boolean match string base pattern string regex pattern check for nulls if base pattern null regex pattern null return false return match base pattern regex pattern 0 0
matches using simple regex algorithm
public void body string body text throws exception any child rules new rules any child rules digester get rules digester set rules new rules get old rules
this is only invoked after all child elements have been processed
public string find namespace uri string prefix array stack ns stack array stack namespaces get prefix if ns stack null return null try return string ns stack peek catch empty stack exception e return null
return the currently mapped namespace uri for the specified prefix
public void add alias string element name string property name element names put element name property name
add an additional custom xml element property mapping
public string to string string buffer sb new string buffer bean property setter rule sb append property name sb append property name sb append return sb to string
render a printable version of this rule
public void add string pattern rule rule string buffer buffer new string buffer buffer append prefix if pattern starts with buffer append buffer append pattern delegate add buffer to string rule
register a new rule instance matching a pattern which is constructed
public string to string string buffer sb new string buffer set nested properties rule sb append allow unknown child elements sb append allow unknown child elements sb append trim data sb append trim data sb append element names sb append element names sb append return sb to string
render a printable version of this rule
public digester get digester return delegate get digester
this method passes through to the underlying rules object
public string get namespace uri return delegate get namespace uri
this method passes through to the underlying rules object
public list match string namespace uri string pattern return delegate match namespace uri pattern
this method passes through to the underlying rules object
public flow node get self flow throws middle node not fount exception final string self unit path new string omega const core execute self unit path return flow node this get global get next node by path self unit path
java java main self
public list rules return delegate rules
this method passes through to the underlying rules object
public void set digester digester digester delegate set digester digester
this method passes through to the underlying rules object
public void set namespace uri string namespace uri delegate set namespace uri namespace uri
this method passes through to the underlying rules object
public void begin attributes attributes string attr name attributes get value attr name string prop name attributes get value prop name set properties rule rule set properties rule digester peek rule add alias attr name prop name
add the alias to the set properties rule object created by the
public void begin attributes attributes string attr name attributes get value attr name string prop name attributes get value prop name set nested properties rule rule set nested properties rule digester peek rule add alias attr name prop name
add the alias to the set nested properties rule object created by the
public void set custom content handler content handler handler custom content handler handler
redirects or cancels redirecting of sax content handler events to an
public void set stack action stack action stack action this stack action stack action
define a callback object which is invoked whever an object is pushed onto
public stack action get stack action return stack action
see set stack action
public map get current namespaces if namespace aware log warn digester is not namespace aware map current namespaces new hash map iterator ns iterator namespaces entry set iterator while ns iterator has next map entry ns entry map entry ns iterator next try current namespaces put ns entry get key array stack ns entry get value peek catch runtime exception e rethrow after logging log error e get message e throw e return current namespaces
get the most current namespaces for all prefixes
public void end document throws saxexception if sax log is debug enabled if get count 1 sax log debug end document get count elements left else sax log debug end document fire finish events for all defined rules iterator rules get rules rules iterator while rules has next rule rule rule rules next try rule finish catch exception e log error finish event threw exception e throw create saxexception e catch error e log error finish event threw error e throw e perform final cleanup clear
process notification of the end of the document being reached
public object parse file file throws ioexception saxexception configure input source input new input source new file input stream file input set system id file to url to string get xmlreader parse input cleanup return root
parse the content of the specified file using this digester
public object parse input source input throws ioexception saxexception configure get xmlreader parse input cleanup return root
parse the content of the specified input source using this digester
public object parse input stream input throws ioexception saxexception configure input source is new input source input get xmlreader parse is cleanup return root
parse the content of the specified input stream using this digester
public object parse reader reader throws ioexception saxexception configure input source is new input source reader get xmlreader parse is cleanup return root
parse the content of the specified reader using this digester
public object parse string uri throws ioexception saxexception configure input source is create input source from url uri get xmlreader parse is cleanup return root
parse the content of the specified uri using this digester
public object parse url url throws ioexception saxexception configure input source is create input source from url url get xmlreader parse is cleanup return root
parse the content of the specified url using this digester