input
stringlengths
10
828
output
stringlengths
5
107
private void init jpanel buttons new jpanel buttons set layout new grid bag layout jbutton button new jbutton jsecret i18n get string dialog cancel button add action listener this buttons add button jbutton button ok new jbutton jsecret i18n get string dialog ok button ok add action listener this buttons add button ok button ok set selected true set layout new border layout add get entry panel add buttons border layout south get root pane set default button button ok this pack this set resizable false
displays all components of this dialog
private void init jpanel buttons new jpanel buttons set layout new grid bag layout jbutton button new jbutton jsecret i18n get string dialog cancel button add action listener this buttons add button jbutton button ok new jbutton jsecret i18n get string dialog ok button ok add action listener this buttons add button ok button ok set selected true add this get durability slider panel border layout center add buttons border layout south this pack this set resizable false
displays all components of this dialog
protected jtext field get text field jtext field result new jtext field result set editable false result set highlighter null result set preferred size new dimension 100 result get preferred size height return result
generates new instance of a jtext field
public void set text string string message set text string
sets the text in the left part of the status bar
public void action performed action event e if e get source instanceof jbutton jbutton source jbutton e get source if source get text equals jsecret i18n get string dialog ok owner entry panel entry set policy policy else if source get text equals jsecret i18n get string dialog cancel dispose
if ok is pressed the password is changed
private void center rectangle bounds owner get bounds int left int math round bounds x bounds width this get width 0 2 int top int math round bounds y bounds height this get height 0 2 this set bounds left top this get width this get height
centers this component on basis of the main window
private string number to string int value if value 10 return value else return value
takes a number and transforms it into a string
public void action performed action event e if e get source instanceof jbutton jbutton source jbutton e get source if source get text equals jsecret i18n get string dialog ok owner entry panel entry set durability slider get value owner entry panel update durability else if source get text equals jsecret i18n get string dialog cancel dispose
if ok is pressed the password is changed
public void state changed change event e if e get source instanceof jslider jslider input jslider e get source if input slider slider label set text number to string slider get value
invoked whenever a radio button is clicked or a slider is moved
public final class dialog new password extends jdialog implements action listener private static final long serial version uid 2568599865737686035 l the main window this variable is used to center the dialog and to disable it while the dialog is shown private main window owner
dialog to change the global password of this password management file
private boolean may drop drop target drop event dtde default mutable tree node parent if is in path source old node parent get path return false if source old node parent return false if parent get allows children return false if source old node get parent parent return false return true
checks whether a node may be dropped on the given target
private boolean is in path default mutable tree node node object path for int i 0 i path length 1 i default mutable tree node compare default mutable tree node path i if node get user object compare get user object return true return false
checks whether the given node is part of the path
private void init set layout new border layout tree new tree new default mutable tree node root owner tree drag source source new tree drag source tree this dn dconstants action move new tree drop target tree source jscroll pane tree view new jscroll pane tree tree add mouse listener this add tree view border layout center
displays all components of this panel
public void action performed action event e string command jbutton e get source get name if command equals name 0 new owner new passwords else if command equals name 1 open owner load passwords open else if command equals name 2 save try owner save passwords catch no file specified exception nfse else if command equals name 3 save as owner save passwords as else if command equals name 5 edit owner change password
part of action listener
private void maybe show popup mouse event e if e is popup trigger tree panel menu popup new tree panel menu owner popup show e get component tree get node for event e get point e get x e get y
displays a tree popup menu when needed
private jmenu get configuration menu jmenu result new jmenu jsecret i18n get string menu configuration add menu item to menu result jsecret i18n get string menu changepwd null null add menu item to menu result jsecret i18n get string menu changepref null null result add mouse listener this return result
configuration menu consisting only of change maser password
protected void update durability data durability set text jsecret i18n get string panel entry change entry get entry outdated string if entry is entry outdated data durability set foreground color red else data durability set foreground color black
updates the durability part of the entry panel
public void mouse entered mouse event e string command jbutton e get source get name old status bar text owner status bar get text field get text owner status bar set text jsecret i18n get string buttonbar info command
whenever the mouse enters a button the status bar is updated and
public void password updated this entry set date new date
this method changes the date of the current password whenever a change
public jmenu get help menu jmenu result new jmenu jsecret i18n get string menu help add menu item to menu result jsecret i18n get string menu about key stroke get key stroke key event vk f1 0 null result add mouse listener this return result
help menu consisting only of about
public void mouse exited mouse event e owner status bar set text old status bar text
when the mouse leaves the button again the old status bar content is
public void set visible boolean value super set visible value data stop clipboard thread
overwrittes set visible boolean value in jpanel
private jmenu item add menu item to menu jmenu menu string text key stroke hotkey icon icon jmenu item menu item new jmenu item text menu item add action listener this menu item add mouse listener this menu item set accelerator hotkey menu item set icon icon menu add menu item return menu item
adds a new entry to the menu
public void mouse entered mouse event e owner repaint
repaints the whole application
public void mouse exited mouse event e owner repaint
repaints the whole application
private int get alphabet length int result lowercase alphabet length if use upper case result uppercase alphabet length if use numbers result numbers length return result
returns the length of the alphabet to generate
public boolean is path editable tree path path default mutable tree node node default mutable tree node path get last path component if is editable return node get allows children return false
overwrittes is path editable in jtree
public object clone return new password policy length repetition use upper case use numbers number of symbols
generate a copy of the current instance
public void set number of symbols int number of symbols this number of symbols number of symbols
sets the number of symbols in the password
public boolean is repetition return repetition
returns true if repetitions allowed
public void set repetition boolean repetition this repetition repetition
sets true if repetitions should be allowed
public boolean is use numbers return use numbers
returns true if numbers should be used
public void set use numbers boolean use numbers this use numbers use numbers
sets true if numbers should be used
public boolean is use upper case return use upper case
returns true if upper case letters should be used
public void set use upper case boolean use upper case this use upper case use upper case
sets true if upper case letters should be used
public void validate query throws jaiom exception
validate if proper values of different query and method params are set
public void add to queue media queue vo mq vo throws jaiom exception synchronized this while this queue size this max items in image queue try wait catch interrupted exception e throw new jaiom exception interrupted exception e if this queue size this max items in image queue notify all this queue add mq vo
the producer here adds item to the queue
public media queue vo get from queue throws interrupted exception synchronized this while this queue size 0 wait if this queue size 0 notify all return this queue remove 0
retruns an item to the consumer
public void add to queue media queue vo mq vo throws jaiom exception synchronized this while this queue size this max items in msqueue try wait catch interrupted exception e throw new jaiom exception interrupted exception e if this queue size this max items in msqueue notify all this queue add mq vo
the producer here adds item to the queue
public void add to queue media queue vo mq vo throws jaiom exception synchronized this while this queue size this max items in video queue try wait catch interrupted exception e throw new jaiom exception interrupted exception e if this queue size this max items in video queue notify all this queue add mq vo
the producer here adds item to the queue
public void add to queue media queue vo mq vo throws jaiom exception synchronized this while this queue size this max items in pdf queue try wait catch interrupted exception e throw new jaiom exception interrupted exception e if this queue size this max items in pdf queue notify all this queue add mq vo
the producer here adds item to the queue
public string get decoder return decoder
returns the video stream decoder name
public video size get size return size
returns the video size
public string read line throws ioexception if lines size 0 return string lines remove 0 else return super read line
it returns the next line in the stream
public void reinsert line string line lines add 0 line
reinserts a line in the stream
public void run process destroy
it kills the supplied process
public void add argument string arg args add arg
adds an argument to the ffmpeg executable call
public input stream get error stream return error stream
returns a stream reading from the ffmpeg process standard error channel
public void destroy if input stream null try input stream close catch throwable t input stream null if output stream null try output stream close catch throwable t output stream null if error stream null try error stream close catch throwable t error stream null if ffmpeg null ffmpeg destroy ffmpeg null if ffmpeg killer null runtime runtime runtime get runtime runtime remove shutdown hook ffmpeg killer ffmpeg killer null
if theres a ffmpeg execution in progress it kills it
public void set bit rate integer bit rate this bit rate bit rate
sets the bitrate value for the encoding process
public void set frame rate integer frame rate this frame rate frame rate
sets the frame rate value for the encoding process
public void set size video size size this size size
sets the video size for the encoding process
public void set audio attributes audio attributes audio attributes this audio attributes audio attributes
sets the attributes for the encoding of the audio stream in the target
public void set video attributes video attributes video attributes this video attributes video attributes
sets the attributes for the encoding of the video stream in the target
public void set sampling rate integer sampling rate this sampling rate sampling rate
sets the sampling rate value for the encoding process
public void set channels integer channels this channels channels
sets the channels value 1 mono 2 stereo for the encoding process
public void set volume integer volume this volume volume
sets the volume value for the encoding process
public audio info get audio return audio
returns a set of audio specific informations
public video info get video return video
returns a set of video specific informations
private void copy file string path file dest throws runtime exception input stream input null output stream output null try input get class get resource as stream path output new file output stream dest byte buffer new byte 1024 int l while l input read buffer 1 output write buffer 0 l catch ioexception e throw new runtime exception cannot write file dest get absolute path finally if output null try output close catch throwable t if input null try input close catch throwable t
copies a file bundled in the package to the supplied destination
public void init font names vector vect uifont family names allocation de m moire avec nombre de familles de fonts font families new string vect size for int i 0 i vect size i font families i string vect get i
initialization of font names field from i phone available family fonts
public void init font names vector vect uifont family names font families new string vect size for int i 0 i vect size i font families i string vect get i
initialization of font names field from i phone available family fonts
public void filter content for search text filtered contacts remove all elements string research search bar text for int i 0 i contacts length i boolean res matches contacts i research if res filtered contacts add contacts i this table view reload data
filter all contacts in function of search bar text
public void change page int page cgpoint content offset new cgpoint content offset init 320 page 0 scroll view set content offset animated content offset true
change content offset of the scroll view to the new current page
public void change image int direction current image direction if current image 0 current image 5 else if current image 5 current image 0 my view get image view set image uiimage image named images current image jpeg system out println affiche l image images current image jpeg if bug fixed seg control tab set selected segment index current image
change image in my view
protected void set up throws exception file dir1 new file try path dir1 get canonical path catch ioexception ex string buffer strb new string buffer path strb append users xml users file strb to string string buffer strb2 new string buffer path strb2 append threads xml threads file strb2 to string data manipulator new data manipulate users file initiator new db initiator users file threads file forum db initiator init forum db this registered new domain registered alice pass this moderator new domain moderator moderator pass
set up the environment for executing forum
public void test add post this thread add post post domain post test post this thread get post post get id assert assert equals error wrong post post get id test post get id
test add post
public void test add posts domain post test post new domain post 0 null null test user1 msg title domain post test post2 new domain post 1 null null test user2 msg titlte vector domain post posts vector new vector domain post posts vector add element test post posts vector add element test post2 this thread add posts posts vector assert assert equals error post wasnt found after adding posts this thread get post 0 get id 0 assert assert equals error post wasnt found after adding posts this thread get post 1 get id 1
test add posts
public void add thread string parent id string thread id data manipulator add thread parent id thread id
this adds a new child thread to a parent thread
public boolean set rank string username int rank return this data manipulator set rank username rank
this sets a users rank 0 registered 1 admin 2 moderator
public boolean login user string user name string password return this data manipulator login user user name password
this adds the logged in user to the logged users data base
public boolean log out user string user name string password return this data manipulator log out user user name password
this removes a logged user if logged from the logged users data base
public boolean delete message post post thread thread return ui ui services delete msg this is moderator post thread
deletes a given message
public boolean set user as moderator string user name return ui ui services set moderator user name
changes a given registered user status to be a moderator
public void set as moderator this is modrator true
sets the registered user to be a moderator
public boolean set user as admin string user name return ui ui services set admin user name
changes a given registered user status to be an admin
public void set as admin set as moderator this is admin true
sets the registered user to be a admin
public void start gui this my gui run gui my gui new main forum page this while true if this any req system out println requset
starts the gui
public void test file mac throws exception for int i 0 i run test macalg length i mac1 macs generate file mac run test tempfolder readable txt run test tempfolder run test macalg i 1 new string buffer password run test alg i 0 run test macalg i 0 mac2 macs generate file mac run test tempfolder readable txt run test tempfolder run test macalg i 1 new string buffer password run test alg i 0 run test macalg i 0 assert assert equals mac1 to string mac2 to string
test file mac
public void test generate keys throws exception for int i 0 i run test alg length i string fileloc run test tempfolder run test alg i 0 run test alg i 1 key keystore generate key run test alg i 0 integer parse int run test alg i 1 null fileloc new string buffer password
test generating symmetric block cipher keystores
public void test file digest throws exception for int i 0 i run test digestalg length i digest1 digesters hash file run test tempfolder readable txt run test digestalg i digest2 digesters hash file run test tempfolder readable txt run test digestalg i assert assert equals digest1 to string digest2 to string
test file digesters
public void test pbe throws exception for int i 0 i run test pbealg length i for int j 0 j run test text length j ciphertext pbecrypt encrypt run test text j new string buffer password run test pbealg i plaintext pbecrypt decrypt ciphertext new string buffer password run test pbealg i assert assert equals plaintext to string run test text j to string
test pbe encryption
static public void blank byte bytes for int t 0 t bytes length t bytes t 0
zero out the passed in byte array
static public void blank string buffer stringbuffer if stringbuffer null stringbuffer delete 0 stringbuffer length
zero out the passed in string buffer
public void test file hmac throws exception assert assert equals hmacs mac from file run test tempfolder readable txt to string 88 l5 gnt kuj rg jci e9 cxv1 ylom
test file hmac
public void test generate key throws exception key generatekey run test tempfolder tempkey key new string buffer password new string buffer 123456789
test key generation
public void test load key throws exception safe object k new safe object k key loadkey run test tempfolder tempkey key new string buffer password
test key loading
public void test file digest throws exception assert assert equals digesters digest from file run test tempfolder readable txt null to string o hhf8dn23j348n jr ii7n a
test file digest
public key exception string message super message
create a key exception with the given message
public crypto exception string message super message
create a crypto exception with the given message
public void set sec keystore count int sec keystore count sec keystore count sec keystore count
sets the pbe iteration count default 100
public void test file encryption throws exception safe object k new safe object k key loadkey run test tempfolder tempkey key new string buffer password mac macs mac from file run test tempfolder readable txt k assert assert true macs mac equals file run test tempfolder readable txt mac k
test file encryption
public void set sec keylength int sec keylength sec keylength sec keylength
sets the aes keybits default 256
protected void tear down throws sqlexception conn close
runs a the end of the tests close database
public boolean accept file f if f is directory return true string ext get file extension f if ext null if ext equals ignore case extension return true else return false return false
accept all directories with or without extension and all files with given extension
public string get value string name string value string values get name return ch ehi basics tools string utility purge value
gets a property value
public object get transient object string name object value transient values get name if value null value instanceof string return ch ehi basics tools string utility purge string value return value
gets a transient property value
public string get transient value string name return string get transient object name
gets a transient property value
public boolean has seen errors return errors
have there been errors logged
public void clear errors errors false
clear flag of seen errors