input
stringlengths
10
828
output
stringlengths
5
107
public void close throws gathering exception try in close catch ioexception e throw new gathering exception gathering exception enum io error an error occurred when closing resources
close and return resources previously acquired through a call to open
protected string read line throws gathering exception if in null string tmp mess if infile null tmp mess the file infile to string has not been opened properly internal error else tmp mess no file was specified nor opened properly internal error throw new gathering exception gathering exception enum datasource is not properly initialised tmp mess try line in read line catch ioexception e throw new gathering exception gathering exception enum io error file infile to string return line
read a line from the previously opened file
private string random pno final long x date random date new date x format formatter new simple date format yyyy mmdd 9999 return formatter format random date
creates a pseudo person number from a date in numerical format
public string transform filename final string filename template todo implement keywords that extract the date and time in a more reasonable format yyyy mm dd hhmm preferably extract it from a date instead of a string string tmp filename filename template tmp filename tmp filename replace all startdate startdate replace all tmp filename tmp filename replace all enddate enddate replace all return super transform filename tmp filename
builds a filename from code filename template code and replaces
private string random date final long x date random date new date long x format formatter new simple date format yyyy mm dd return formatter format random date
formats a date as a code string code from its numerical format
private string random main sample id final long x final int i date random date new date long x format formatter new simple date format yyyy return formatter format random date i
creates an artifical sample id
private string random name string f name emma agnes maja alexandra julia alicia ida alma linn a alva elin amanda alva amelia hanna anna ella annie astrid wilma cornelia klara ebba moa elin
builds an pseudo artifical person name
private string random vital status if int math random 2 0 return alive else return dead
returns a random vital status
private string random preparation result string preparation result whole blood plasma serum dna rna protein lipid carbohydrate edta plasma heparin plasma citrated plasma liquor unspecified return preparation result int math random preparation result length
returns a random preparation result
private string random storage form string storage form freezed freeze dried specimen slide paraffin block return storage form int math random storage form length
returns a random storage form
private string random storage temperature string storage temperature room temperature cold room freezer 20 degc freezer 70 degc freezer 140 degc freeze dried liquid nitrogen return storage temperature int math random storage temperature length
returns a random storage temperature
public void open throws gathering exception establish the connection to the database try logger debug opening database connection to host db host port db port login db login db connection driver manager get connection jdbc url db login db password catch sqlexception e throw new gathering exception gathering exception enum required resource not available e could not create a connection to the database host db host port db port login db login
aquire and open resources neccesary for gathering the data
public void close throws gathering exception close the connection to the database try db connection close db connection null catch sqlexception e throw new gathering exception gathering exception enum io error e could not close a database connection
close previously aquired resources
public string get db driver class return db driver class
gets the name of the jdbc class that are used for this datasource
public void set db driver class final string db driver class in db driver class db driver class in
sets the name of the jdbc class that are used for this datasource
public string get db port return db port
gets the port of the database
public void set db port final string db port in db port db port in
sets the port of the database
public void set jdbc url final string jdbc url in jdbc url jdbc url in
sets the jdbc url
public string transform filename final string filename template return filename template
builds a filename from code filename template code and replaces
public datafile get datafile return datafile
returns the code datafile code that this code datasource code
public gathering exception enum get error code return this error code
returns the error code value
public void finalise throws generation exception parameter exception store persistent properties datafile store persistent properties
handles the fact that the datafile has been successfully created
public string transform filename final string filename template string tmp filename filename template tmp filename tmp filename replace all extension get extension return super transform filename tmp filename
builds a filename from code filename template code and replaces
public file output stream get file out stream return file out stream
gets the code file output stream code
public void set file out stream final file output stream file out stream in this file out stream file out stream in
sets the file output stream
public void set extension final string extension in this extension extension in
sets the file extension
public datafile get datafile final int index throws container exception object tmp get object index if tmp instanceof datafile return datafile tmp throw new container exception container exception enum object of wrong type
return the code datafile code object from index position
public file get clean dir return clean dir
return the directory to clean
public int get sortcriteria return sortcriteria
returns the criteria to sort on as defined by constants
public int get sortorder return sortorder
returns the sorting order as defined by the constants ascending and
public long get keepnumber return keepnumber
returns the number of files in the configured directory with the
public void clean throws cleaning exception get the file list list file list list files get clean dir sort the file list sort files file list tries to delete a number of files from the file list delete files file list
tries to delete a number of files from the configured directory
public boolean accept final file file return file is file filename pattern matcher file get name matches
tests the supplied file
private list list files final file clean dir file filter file filter new pattern file filter get pattern file file array clean dir list files file filter return new array list arrays as list file array
lists the files in the supplied directory
public cleaning exception enum get error code return this error code
returns the error code value
private void delete files final list file list long files to delete file list size get keepnumber if files to delete 0 logger debug no files to clean up in directory get clean dir get absolute path else if files to delete 0 string tmp list for int i 0 i files to delete i file tmp file file file list get i tmp file delete tmp list tmp list tmp file get name if tmp list length 0 logger info cleanup in directory get clean dir get absolute path deleted files tmp list substring 0 tmp list length 2
tries to delete the first file list
private int signum final long i if i 0 return 1 if i 0 return 1 return 0
returns the signum function of the specified long value
public transfer exception enum get error code return this error code
returns the error code value
public file get local archive dir return local archive dir
returns the value of local archive dir
public file get local upload dir return local upload dir
returns the value of local upload dir
public string get remote dir name return remote dir name
returns the value of remote dir name
public void set connected final boolean connected in this connected connected in
sets the connection status of the transport medium
public parameter exception enum get error code return this error code
returns the error code value
public void close if csftp null csftp disconnect if session null session disconnect set connected false logger debug disconnected from host host
close the connection
public void cd final string remote path throws transfer exception if session null try first return to the home directory to make relative paths work cd as specified by the sftp specification should theoretically work but due to a bug in jsch it doesn t csftp cd homedir csftp cd remote path logger debug remote directory changed to remote path catch sftp exception e throw new transfer exception transfer exception enum could not change remote directory e remote directory remote path
change the remote current directory
public void put final file file throws transfer exception try csftp put file to string file get name set file permission csftp chmod permission file get name catch sftp exception e throw new transfer exception transfer exception enum could not transfer file e file file get absolute path
transfer a file to the connected system
public boolean prompt yes no final string str return true
prompt for yes or no
public boolean prompt passphrase final string message return true
prompt for passphrase for a key
public boolean prompt password final string message return false
prompt for password
public void show message final string message
show a message
public date get start date throws exception return date get start
startdate of the interval
private void create minute line jlabel line new jlabel line set background this config get line color line set opaque true minute lines add line panel add line
creates a new jlabel for a line and adds it to the panel
public void set start end time of day start time of day end this start start this end end refresh
sets the start end end interval
public void set event event event this event event compute colors if this event null this bg color event get color if this event null this event is background this font color color black else this font color compute foreground this bg color this alpha font color new color font color get red font color get green font color get blue 220 try set background event get color catch exception e e print stack trace
set the event object for the frame area
public void set head line string a head line its head line a head line if a head line null its head line
label text placed on the first line in the frame area
public void set description string a description its description a description if a description null its description
label text placed below head line in the frame area
public void set brightness boolean b if b this alpha value alpha default select offset else this alpha value alpha default select offset
switches the brightnes of a frame area
public int get default day end hour return this day end default
get the default day end hour
public int get default day start hour return this day start default
get the default day start hour
public image icon get upper right icon return upper right icon
get the icon that is painted in the upper right corner
public void set upper right icon image icon upper right icon this upper right icon upper right icon
set an icon for the upper right corner
public int get hours return this get day end hour this get day start hour
returns the amount of hours to display
public void set day break int break hour this break hour break hour
set the day break hour
public int get line distance return this line distance
get the line distance for the diagonal lined background of
public int get day break return this break hour
get the day break hour
public void move date new start date if new start date null set end new date get end get time date util get diff day get start new start date set start new start date
moves the event to a new startdate
public void show header boolean b this show header b
show the darker header
public event copy event e new event e set background is background e set color get color e set description get description e set editable is editable e set end get end e set frame is frame e set icon get icon e set id get id e set level get level e set org event get org event e set rounded corner is rounded corner e set selectable is selectable e set show time is show time e set start get start e set summary get summary e set tool tip get tool tip return e
duplicate this object
public void add button abstract button jb if columns 1 jb set horizontal alignment jbutton left else jb set margin new java awt insets 2 2 2 2 content add jb
adds a button to the panel
public void add toggle button jtoggle button jb if columns 1 jb set horizontal alignment jbutton left else jb set margin new java awt insets 2 2 2 2 content add jb button group add jb
adds a button to the panel
public void remove button abstract button jb content remove jb if jb instanceof jtoggle button button group remove jb
removes a button from the panel
public void add action action a jbutton b new jbutton a map put a b add button b
adds an action to the panel as button
public void add toggle action action a jtoggle button b new jtoggle button a map put a b add button b
adds an action to the panel as togglebutton
public void remove action action a abstract button b map get a map remove a remove button b
removes an action from the panel
public void set content layout layout manager layout this content set layout layout
sets the layout of the content panel
public void add calendar view calendar view calendar view this calendar view calendar view events update dependents
add calendarview for refreshing
public jpopup menu add popup jtext component text component jpopup menu menu new jpopup menu add popup menu items menu text component return menu
adds a jpopup menu to any jtext component
public void set title string title title title if title null set border null else set border new titled border title
sets the title of the form group using a titled border
public void set title border border string title title title if title null set border null else set border new titled border border title
sets the title of the form group using a titled border
public jcombo box add form choice item string label jcombo box cb new jcombo box add form item factory create form item label cb return cb
adds a new jcombo box to this form group with the specified label
public jlabel add form label item string label text jlabel label new jlabel label text add form item factory create form item label return label
adds a new jlabel to this form group with the specified label
public jlabel add form centered label item string label text jlabel label new jlabel label text add form item factory create centered form item label return label
adds a new jlabel to this form group with the specified label
public jtext component add form text area item string label jtext area ta new jtext area add form item factory create form item label ta box layout y axis return ta
adds a new jtext area to this form group with the specified label
public jbutton add button jbutton button add button add create glue return button
add the given jbutton to the box with needed spacing
public jbutton add button string text jbutton button new jbutton text add button button return button
add a new jbutton to the box with the specified text label and
public jtext component add form text field item string label jtext field tf new jtext field add form item factory create form item label tf return tf
adds a new jtext field to this form group with the specified label
public int get shape type return shapefile point
returns the shapefile shape type value for a point
public int get num parts return num parts
find out how many parts make up this arc
public int get record count return records size
gets the number of records stored in this shapefile
public int get shape type return shapefile arc m
get the type of shape stored shapefile
public int get shape type return shapefile arc
get the type of shape stored shapefile
public shapefile shape get shape int index shape record r try r shape record records element at index catch java lang array index out of bounds exception e return null return r get shape
returns a shapefile shape
public int get shape type return main header get shape type
gets the type of shape stored in this shapefile
public string get shape type description return get shape type description main header get shape type
returns a description of the shape type stored in this shape file
public int get field number string name for int i 0 i numfields i system out println i system out println fielddef i fieldname to string name if name trim equals ignore case fielddef i fieldname to string trim return i return 1 not found
looks up the field number for the given named column
public dbf file header ledata input stream file throws ioexception get dbf file header file
reads the header of a dbf file
public string buffer get dbf rec int row throws java io ioexception string buffer record new string buffer rec size numfields r file seek data offset rec size row for int i 0 i rec size i we could do some checking here record append char r file read unsigned byte return record
fetches the i row i th row of the file
public string buffer get dbf rec int row throws java io ioexception string buffer record new string buffer rec size if debug system out println get dbf rec row records row return record new string buffer records row to string
fetches the i row i th row of the file
public string buffer get dbf rec int row throws java io ioexception string buffer record new string buffer rec size if debug system out println get dbf rec row records row if is file return record new string buffer records row to string else record new string buffer rec size numfields r file seek data offset rec size row for int i 0 i rec size i we could do some checking here record append char r file read unsigned byte return record
fetches the i row i th row of the file
public notebook permissions get permissions string owner notebook permissions perms null if owner starts with private perms new private notebook permissions owner substring owner last index of 1 owner length else fake profile prof fake profile get instance user registry reg user registry get instance if prof get users owner size 0 if reg get group owner null perms new private notebook permissions owner substring owner last index of 1 owner length else perms new group notebook permissions owner return perms
returns an appropriate permissions object based on the owner