input
stringlengths
10
828
output
stringlengths
5
107
public void run string task name boolean disable menu and controls throws exception show progress window if disable menu and controls disable menu and windows controls run the task task run if disable menu and controls enable menu and controls remove the progress window
this method is called from within the workers thread
synchronized static public void test log java lang string msg string file name jafu environment get log file name if jafu environment is production log test msg file name test log
logs the message to a test log file
public boolean write from input stream input stream is file output stream fos null try bind input to output stream is new file output stream this catch exception e system out println writing the file get name from input stream failed error e return false return true
method writes the data obtained from the provided input stream
public boolean write to file string text try buffered writer out new buffered writer new file writer this out write text out close catch ioexception e system out println error while writing to file get path e print stack trace return false system out println report saved to file get path return true write to file
save the text specified to this file
static public void information message box string msg javax swing joption pane show message dialog null msg information javax swing joption pane information message
shows an info message centered
public void set print target jcomponent o print target o set instance var
sets the print target this class will just print that object
public void action performed java awt event action event evt string action string evt get action command to string if action string equals ok return value get return value if return value null it means the child wants the action to be ignored return set visible false close window else if action string equals cancel cancel mode true set visible false close window else if custom action performed action string utilities error message box a custom action requested but not processed correctly please contact is
sets the return value
static public void error message box string msg javax swing joption pane show message dialog null msg error javax swing joption pane error message
shows the error message centered
public string get column name int column if column labels column null return column labels column else if column names column null return column names column else return
provides the column label or the db column name if no label specified
public boolean is cell editable int row int column if table editable return false return jdbc adapter is cell editable row column
table model method
public object get value at int a row int a column vector row vector rows element at a row object obj row element at a column string str jdbc adapter get column display value a column obj null obj to string if str null return str return obj
table model method
public void sort by column int column boolean ascending this ascending ascending ascending direction remove all elements ascending direction add element new boolean ascending sorting columns remove all elements sorting columns add element new integer column sort this super table changed new table model event this
sorts by a single column in the direction specified
public void set column editable string column boolean f throws exception jdbc adapter set column editable column f
sets a column editable or not
public void add insert button string query boolean refresh after insert insert in place button mode false insert button mode true insert query query this refresh after insert refresh after insert
enables the insert new row in new window function
public void set column label string column string label try jdbc adapter set column label column label catch exception e utilities error message box e to string e print stack trace
sets column labels to be displayed as column headers
public boolean initialize column code table string column name string query throws exception return jdbc adapter initialize column code table column name query
initializes code table for a column
public boolean set query string q query q get the data only after this is done the columns meta data is known if query null utilities error message box query string is empty return false fetch return true
set the sql query text
static public void set database type int type dbconnection null database type type
call to set the type of the db used
public void show it throws exception if main panel null build it restore window layout this set visible true show it
shows a table with the data
public void set preferred size int width int height main panel set preferred size new dimension width height this pack
set the preferred size of the table
public void adjust preferred size int width delta int height delta int width main panel get preferred size width width delta int height main panel get preferred size height height delta main panel set preferred size new dimension width height this pack
adjust the preferred size of the data edit panel
public void set text area threshold int characters text area character threshold characters
call before build it
public void set save restore window layout boolean flag save restore window layout flag
call to disable enable the feature that saves and restores
public void set column editable string column boolean f throws exception for int i 0 i column names length i i is the column index in model coordinates if column names i equals column column editable i f return throw new exception column not found
sets a column editable or not
static public void set global save restore window layout boolean flag global save restore window layout flag
call to disable enable the feature that saves and restores
public void add delete button add delete button null
adds a delete button that will delete all selected rows
public void set all columns editable boolean f for int i 0 i column editable length i column editable i f
sets all columns to be editable
public void add delete button string columns delete button mode true delete message columns columns
adds a delete button that will delete all selected rows
public void set column label string column string label throws exception for int i 0 i column names length i i is the column index in model coords if column names i equals column column labels i label in show it fire table changed new table model event this table model event header row return throw new exception column not found
sets column labels to be displayed as column headers
public string get column display value int column string store value if column code table column null return null if code table add empty row column store value null return return string column code table column get store value
for given column provide the display value corresponding to the
public string get column store value int column string display value return get column store value column display value true
for given column provide the store value corresponding to the
public string get column store value int column string display value boolean alarm if no code table if column code table column null if alarm if no code table return null else return display value for java util enumeration en column code table column keys en has more elements object sv en next element string dv string column code table column get sv if dv equals display value return sv to string if code table add empty row column display value length 0 return null return null
for given column returns the store value corresponding to the
public void set locking columns string column names throws exception store corresponding column indexes locking column indexes new vector for int i 0 i column names length i int col ind get column index column names i locking column indexes add new integer col ind for java util enumeration e column names elements e has more elements int col ind get column index string e next element locking column indexes add new integer col ind return
specifies which columns are to be used in the where clause to
public void set column date time type int column index if column date time type null column date time type new boolean get column count column date time type column index true
specifies the column to be date and time type of
public int get column display size int column int size try size meta data get column display size column 1 catch exception e size 1 return size
returns the columns display size or 1 if an error occured
public void build it throws exception pre build it table panel jcomponent table panel create jdbctable panel main panel add table panel java awt border layout center button panel jcomponent button panel create jdbcbutton panel main panel add button panel java awt border layout south this pack build it
retrieve the data and build the table
public boolean initialize column code table string column name string query throws exception return data base initialize column code table column name query
initializes drop down code table for a column
public boolean initialize column code table string column name hashtable code table throws exception return data base jdbc adapter initialize column code table column name code table
initializes drop down code table for a column
public boolean initialize column code table string column name hashtable code table boolean check for unique throws exception return data base jdbc adapter initialize column code table column name code table check for unique
initializes drop down code table for a column
public void refresh table data boolean with dbretrieve if with dbretrieve data base execute query query trim mode retrieve the data again from db data base filtered rows new java util vector emptying the filtered rows buffer data base fire table data changed tell the listeners that the data has changed setup columns sort by columns
redisplay the data in the table
public void add custom button string text jdbctable clickable b if custom button objects null custom button objects new vector if custom button text null custom button text new vector custom button objects add b custom button text add text add custom button
adds a custom button to the jdbctable window
public void filter row out int row data base filter row out sorter get row model index row
filter out a row of the table
public void set insert default value string column string value if default values null default values new hashtable default values put column value set insert default value
sets the defult value for a new record
public void add filter button string column if parsed query null utilities error message box method set query string string string string is required before this mothod is called query null to inforce return filter column column
add the button to filter the data by a single column
public void add filter button if parsed query null utilities error message box method set query string string string string is required before this method is called query null to inforce filter button any columns true
add the button to filter the data by user selected columns
public void filter query string filter column string input value if parsed query null utilities error message box method set query string string string string is required before this method is called query null to inforce update the query parsed query set filter upper filter column like input value to upper case query parsed query to string re retrieve refresh table data true
set a filter on the query and filter the table
public object get value at string column int row throws exception return get value at column row true get value at
user convenience method
public object get value at string column int row boolean display value throws exception int col ind data base jdbc adapter get column index column column model index object value table get value at row col ind this is display value if value null display value object save value value value data base jdbc adapter get column store value col ind value to string if value null value save value return value get value at
user convenience method
public void set sort vector sorting columns vector ascending direction boolean resort after insert throws exception this sorting columns new vector for enumeration e sorting columns elements e has more elements int ind get column index string e next element this sorting columns add new integer ind this ascending order ascending direction this resort after change resort after insert
specify columns by which the table is sorted after retrieving it
public void set compare strings as numbers string column name throws exception sorter set compare string mode get column index column name
usually a string 10 is sorted as smaller than 9
public void set locking columns string ar throws exception data base jdbc adapter set locking columns ar
specifies which columns are to be used in the where clause to
public void set column date time type int column index if data base null utilities error message box setting column date time type before the table is built return data base jdbc adapter set column date time type column index
specifies the column to be date and time type of
public void set drop down assistant string col name string new item label drop down assistant assistant int col index 1 try col index get column index col name catch exception e utilities error message box invalid column name or another error while setting the drop down assistant return data base jdbc adapter set drop down assistant col index new item label assistant
sets the assistant for the drop down
public void set sequence object string column name string sequence object if insert sequence object null utilities error message box error setting the sequence object only one sequence column object per table allowed return else insert sequence column name column name insert sequence object sequence object
if you use the insert row feature and the table you insert into
public void add insert in place button insert button mode false insert in place button mode true add insert in place button
inserts a row in the main table
public void close close window action performed
closes the window
public void set text string text j text area set text text j text area set caret position 0
set license text
public void disconnect synchronized this stop stat thread if m in null try m in close catch exception ex ex print stack trace m in null if m out null try m out close catch exception ex ex print stack trace m out null if m socket null try m socket close catch exception ex ex print stack trace m socket null m b up false inform listener state changed
disconnect from server
public boolean connect string host or ip int port disconnect boolean b ok false try synchronized this m socket new java net socket host or ip port m out new print writer m socket get output stream true m in new buffered reader new input stream reader m socket get input stream string answer m in read line inform listener got answer new string answer if answer compare to ready 0 disconnect else b ok true launch stat thread catch exception ex ex print stack trace disconnect inform listener state changed return b ok
connect to server
private void launch stat thread stop stat thread m stat thread new stat thread this m stat thread start
launch thread monitoring status
private void stop stat thread if m stat thread null m stat thread set stop m stat thread null
stop thread monitoring status
public boolean is connected boolean b connected false synchronized this b connected m socket null return b connected
obtain connection status
public void j menu file exit action performed action event e m masqclient send m masqclient kill m masqclient disconnect system exit 0
file exit action performed
public boolean is up boolean b up false synchronized this b up is connected m b up return b up
obtain dial up link status
public void send final string cmd send cmd true
send command string to server
public void j menu help about action performed action event e main frame about box dlg new main frame about box this dimension dlg size dlg get preferred size dimension frm size get size point loc get location dlg set location frm size width dlg size width 2 loc x frm size height dlg size height 2 loc y dlg set modal true dlg pack dlg show
help about action performed
public void inform listener state changed boolean b connected is connected synchronized this iterator iter m listener set iterator while iter has next try masq client listener listener masq client listener iter next listener state changed b connected catch exception ex ex print stack trace
inform listeners about connection state change
public void inform listener got answer string cmd string answer synchronized this if cmd length 0 don t save ready last cmd new string cmd last answer string answer clone if cmd compare to masq client stat 0 m b up answer length 0 answer 0 starts with up iterator iter m listener set iterator while iter has next try masq client listener listener masq client listener iter next listener got answer cmd answer catch exception ex ex print stack trace
inform listeners about answer from server
public void inform listener got answer part string cmd string answer synchronized this iterator iter m listener set iterator while iter has next try masq client listener listener masq client listener iter next listener got answer part cmd answer catch exception ex ex print stack trace
inform listeners about partly received answer from server
protected string get prop filename string filename new string system get property user home system get property file separator jmasqdialer return filename
build property file name
public void state changed final boolean b connected runnable runner new java lang runnable public void run j button dial hangup set enabled b connected j button connect set text b connected disconnect connect if b connected j combo box connections remove all items j combo box connections set enabled false j button dial hangup set text dial swing utilities invoke later runner if b connected m masqclient send masq client list
called if connection state has changed
public void got answer part string cmd string answer if cmd starts with masq client dial if answer length 0 if answer answer length 1 compare to masq client answer begin 0 answer answer length 1 compare to masq client answer end 0 add status line answer answer length 1 else if cmd compare to masq client stat 0 add status line answer 0
called if part of answer from server was received
public url get image size size try return new url get image path size catch malformed urlexception e e print stack trace return null
provides with the
public string get image path size size return size get path this to string
provides with the path of the image representing this
public o get list options map list list o result find list list if result size 0 return result get 0 try o map get type new instance list add map return map catch instantiation exception e e print stack trace catch illegal access exception e e print stack trace return null
it looks up of the provided type of
protected xml namespace dictionary get xml namespace dictionary return constants oos namespace dictionary
override this method to provide with a different
public string wait for verifier string request token synchronized verifier map while verifier map contains key request token try verifier map wait 3000 catch interrupted exception e return null return verifier map remove request token
call that blocks until the oauth provider redirects back here with the
public void add monster monster this monster owner add monster this monster
cast a summon monster spell on this monster then a monster
public void attack being being attacking being
set up to attack this being
public void run first wait for some wizard to join if wizard size 0 tools debug msg this arena waiting for new wizards try synchronized new wizard token new wizard token wait catch exception e e print stack trace sync all wizards start tools debug msg this arena starting game game started true do get wizards survivor count count survivors sync all wizards poit tools debug msg this arena wizard count survivor count while survivor count 1 wizard array length 1 while true
this thread runs solely to synchronize the threads running for
public void add monster monster monster return
add a new monster to this being empty class that must be
public void add enchant letter char letter enchant string next turn enchant string next turn concat letter
add an enchantment letter to the enchant string
public void clear enchant string enchant string new string enchant string next turn enchant string next turn new string
reset the enchant string to be empty not null
public void next turn turn turn 1 8 clear enchant string hp hp delta hp delta 0 if hp 0 is alive false else if hp max hp hp max hp
tell the being to proceed to the next turn
public vector get effects vector ret val new vector for int i 0 i effect size i if effect instance effect element at i when turn ret val add effect instance effect element at i effect remove i the vector shrinks so i decrease i return ret val
return all effects connected to the current turn removing them
public message alter effect effect instance effect being caster tools debug msg this spell effect alter effect return internal alter effect effect caster
calls the internal method
protected message internal alter effect effect instance effect being caster tools debug msg this spell effect null effect return null message
override this to alter an effect
public message alter monster monster monster if affect who affect wizard return null message else return internal alter monster monster
calls the internal method
public void remove wizard int wizard connection wizard finish connection wizard destroy connection wizard null
totally get rid of the wizard so as to make sure the player
protected message internal alter monster monster monster return null message
override this method to alter a monster with this effect
public message alter wizard wizard wizard if affect who affect monster return null message else return internal alter wizard wizard
calls the internal method
public void tell string statement out println statement
print a single line on the players terminal
protected message internal alter wizard wizard wizard return null message
override this method to alter a wizard with this effect
public void finish try in close out close s null catch exception e
try to close the session with the user
public void run boolean setting name true string str null while s null try str in read line catch ioexception e if str null continue if str ends with http 1 1 str ends with http 1 0 continue if setting name wizard name str setting name false continue if str starts with if wizard is finished wizard comm to player no commands until other players finish else wizard comm add message str substring 1 else wizard comm tell all wizard name str
main loop for the player thread
public message alter being being being if recurring being add effect 1 null this if enchant letter being add enchant letter enchant letter if being is wizard affect who affect monster being is wizard affect who affect wizard return null message else return internal alter being being
calls the internal method but has checks and continues
protected message internal alter being being being return null message
override this method to alter a being
protected boolean is in list spell effect eff vector v for int i 0 i v size i string item string v element at i if item equals ignore case eff spell name return true if item equals ignore case physical eff physical true return true if item equals ignore case fire eff fire true return true if item equals ignore case ice eff ice true return true return false
checks to see if a spell effect is mentioned in a specific
public void add monster monster this monster this monster owner this this monster name name s this monster type monster vector size monster vector add this monster monsters new monster monster vector size for int i 0 i monster vector size i monsters i monster monster vector element at i
add a monster to this wizard
public void add gestures int left hand int right hand for int i 1 i 8 i left 8 i left 7 i right 8 i right 7 i left 0 left hand right 0 right hand match gestures
add gestures to this wizards history