input
stringlengths
10
828
output
stringlengths
5
107
public void sorting list anime anime quick sort anime anime
sorting a list
public void quick sort anime list anime anime new quick sort anime by anime new compare by name true
sorting lists according to the parameter
private void create biblioteca grid data grid data4 new grid data grid data4 horizontal alignment grid data fill grid data4 grab excess horizontal space true grid data4 grab excess vertical space true grid data4 vertical alignment grid data fill biblioteca new composite c tab folder swt none biblioteca set layout new grid layout l biblioteca new list biblioteca swt v scroll l biblioteca set layout data grid data4 l biblioteca add selection listener new org eclipse swt events selection adapter public void widget selected org eclipse swt events selection event e cargar galeria l biblioteca get selection index cargar galeria
this method initializes biblioteca
private void create buscador ayuda grid data grid data new grid data grid data horizontal alignment grid data fill grid data grab excess horizontal space true grid data grab excess vertical space true grid data vertical alignment grid data fill buscador ayuda new browser s shell swt none buscador ayuda set layout data grid data buscador ayuda set text ayuda inicio html buscador ayuda set url modelando madera googlecode com
this method initializes buscador ayuda
private void initialize this set size 300 200 this set title frame this add get panel border layout center
this method initializes this
private void create canvas grid data grid data1 new grid data grid data1 horizontal alignment grid data fill grid data1 grab excess vertical space true grid data1 grab excess horizontal space true grid data1 vertical alignment grid data fill canvas new canvas this swt none canvas set layout data grid data1 canvas add paint listener new paint listener public void paint control paint event e e gc draw image image buffer 0 0 image buffer new image canvas get display 1200 800
this method initializes canvas
private void create combo figura grid data grid data3 new grid data grid data3 horizontal span 4 grid data3 horizontal alignment grid data fill grid data3 vertical alignment grid data center grid data3 grab excess horizontal space true combo figura new combo this swt none combo figura set layout data grid data3 combo figura add selection listener new org eclipse swt events selection listener public void widget selected org eclipse swt events selection event e mostrar punto combo figura get selection index public void widget default selected org eclipse swt events selection event e
this method initializes combo figura
public void run file input file throws file not found exception invalid format exception int mower number 1 list mower mowers mower file loader build mowers from file input file for mower mower mowers log info mower mower number begins to mow at mower get position mower mow log info mower mower number ends to mow at mower get position mower number
starts mowers after reading a config file
private void load configuration file file input file throws file not found exception invalid format exception configuration file load input file configuration file always have n 1 lines lawn dimension 2x mower position mower instructions if configuration file get count 2 0 throw new invalid format exception the configuration is file malformed some lines are missing
attach the configuration in a configuration file handler
private void load lawn throws invalid format exception string dimensions configuration file next line split if dimensions length num lawn terms throw new invalid format exception configuration file create error message is an invalid field description try int width integer parse int dimensions 0 int height integer parse int dimensions 1 lawn new lawn width height catch number format exception e throw new invalid format exception configuration file create error message is not a couple of integers e
read lawn dimensions from the configuration file
private void load mowers throws invalid format exception while configuration file has more line mower mower mower factory create mower position position read mower position try mower place position get x position get y position get orientation lawn catch invalid position exception e throw new invalid format exception configuration file create error message e get message e list instruction instructions read mower instructions mower program instructions instructions mowers add mower
read position informations and instruction list to build ready to go mowers
public object eval int index throws formula exception object o view model get data forumla type header name index if o instanceof double type double else if o instanceof mark mark m mark o o m get value else if o instanceof boolean type boolean else throw new unsupported format formula exception does support only boolean or double s type return o
evaluate the formula
public void parse iview model view model try lexer lexer new lexer new pushback reader new string reader string form 1024 parser parser new parser lexer start ast parser parse ast apply new symphonie adapter this view model catch exception e throw new formula runtime exception error parsing is parsed true
parse the formula
public jpopup menu get header popup menu return header teacher popup
returns the popup menu of the header
public jmenu item get delete item return delete item
returns the delete item
public jmenu item get remove formula item return remove formula item
returns the remove formula item
public jmenu item get update formula item return update formula item
returns the update formula item
public jmenu item get update item return update item
returns the update item
public jmenu item get copy item return copy item
returns the copy item
public jpopup menu get main student popup return main student popup
returns the main student popup
public jmenu item get print item return print item
returns the print item
public void update items with language print item set text container get language get pop teacher print copy item set text container get language get pop teacher copy
update the text of each item when the language changes
private void formulas to add list iformula formulas data base manager dbm list iformula formulas to remove new array list iformula add all the formula in the list into the database for iformula formula formulas try int id dbm add formula formula get formula name formula get string formula formula get formula path formula get formula type formula set id id formulas to remove add formula catch sqlexception e1 error exists true remove all the formulas that have successfuly added to the data base formulas remove all formulas to remove
add new formulas to the data base
public jcomponent get view return view student panel
returns the view of the student
public jcomponent get view return view teacher panel
return the view of the student
private void update undo redo enabled jtable table container get teacher selected table if table null teacher view model model teacher view model table get model container get menu bar get undo item set enabled model has undo container get menu bar get redo item set enabled model has redo container get tool bar get undo button set enabled model has undo container get tool bar get redo button set enabled model has redo
update the buttons undo and redo to be enabled or disabled
public string to string return name min max
a string representation of the interval
public jmenu get menu file return menu file
returns the menu file
public data base settings get data base settings return db settings
returns the database settings
public preferences get preferences return pref
return a preferences object
public int get window height return height
return the height of the window
public int get window location x return location x
return the x location of the window
public int get window location y return location y
returns the y location of the window
public jmenu item get data base item return data base item
returns the data base item
public void set columns list string columns this columns columns
sets the list of columns
public iformula get formula return formula
returns the formula
public void set formula iformula formula this formula formula
sets the formula
public void set rows list string rows this rows rows
sets the list of rows
public void take the values of renderer data renderer if renderer null return name renderer get name formula renderer get formula foreground color renderer get foreground color background color renderer get background color rows renderer get rows columns renderer get columns
copy the value of the renderer in parameters
public boolean is formula return is formula
returns if the header is a formula or not
public void set formula boolean is formula this is formula is formula
sets the header to be or not a formula
public void set base string base if base null this base else this base base
sets the base
public void set host string host if host null this host else this host host
sets the host
public jmenu item get formula item return formula item
returns the formula item
public void set login string login if login null this login else this login login
sets the login
public void set password string password if password null this password else this password password
sets the password
public void set port string port if port null this port else this port port
sets the port
public void set type string type if type null this type else this type type
set the type
public string to string return type login password host port base
a string representation of the data base settings
public jmenu item get renderer item return renderer item
returns the renderer item
public object get value at int index if index 0 index values size return null return values get index
gets the value at index
public void add value at int index double value values add index new mark value
add a value at the position index
public void set value at int index object value object o get value at index if o instanceof mark mark m mark o if value instanceof double m set value double value else values set index value
sets the value at index
public void remove at int index values remove index
remove an object at position index
public jmenu item get admin log item return admin log item
returns the log to admin item
public string get name if is formula return formula get formula name else return student to string
gets the name of the object
public jmenu item get export item return export item
return the export item
public float get average by subject isubject subject return subject average get subject
this method returns the average of a subject
public jmenu item get import item return import item
returns the import item
public jmenu item get language item return language item
returns the language item
public void add subject isubject subject if subject null return number of rows 3 fire table rows inserted number of rows 4 number of rows 1 list subject component tmp list subject get subject components if tmp list size 1 get column count number of columns tmp list size 1 fire table structure changed
add a new subject to the model
public jmenu get menu edit return menu edit
returns the menu edit
public void remove subject isubject subject if subject null return number of rows 3 fire table rows deleted 0 number of rows list subject component tmp list subject get subject components if tmp list size 1 get column count if the number of columns is egal to the number of subject component of the subject 1 we need to recalculate the number of columns int max 1 for isubject sub subjects int nb elements sub get subject components size 1 if nb elements max max nb elements number of columns max fire table structure changed
remove a subject of the model
public jmenu get menu preferences return menu preferences
returns the menu preferences
public void set element at t object int index list add index object fire interval added this index index
sets an element at a specified position
public void remove element t object int index list index of object list remove object fire interval removed this index list size
remove an element from the list
public void add element t object list add object fire interval added this list size 1 list size
adds an element at the end of the list
private void update undo redo enabled container get menu bar get undo item set enabled has undo container get menu bar get redo item set enabled has redo container get tool bar get undo button set enabled has undo container get tool bar get redo button set enabled has redo
enabled or disabled the undo redo buttons of the toolbar
public jmenu item get quit item return quit item
returns the quit item
public jmenu item get redo item return redo item
returns the redo item
private void add formulas into model iview data datas for each formula for iformula f datas get formulas is undo true add formula f is undo false remove all the formulas added in the list of formula to add into database because these formulas are already in the data base formulas to add remove all formulas to add
add all the formulas when creates the model
public jmenu item get save item return save item
returns the save item
public jmenu item get undo item return undo item
returns the undo item
public data base settings get dbsettings return db settings
returns the settings of the data base
public jmenu item get chart interval item return chart interval item
return the chart interval item
public void set column name int column index string name try header head headers get column index 1 head set name name fire table structure changed catch index out of bounds exception e nothing to do
sets the name of the column header
public void set dbsettings data base settings db settings this db settings db settings
sets the settings of the data base
public boolean is big icons return big icons
returns if the menu has big icons or not
public void set big icons boolean big icons this big icons big icons if big icons icon size item set text container get language get menu icon min else icon size item set text container get language get menu icon max
updates the text when the icons become big or small
public void remove all list remove all list fire interval removed this 0 get size
removes all the element in the list
public void keep only that start with string begin list string l new array list string if list null return for string s list if s null continue if s starts with begin l add s list l fire contents changed this 0 list size
keeps all the element of the list that begin with the string in
public void set lang string langage this lang langage
sets the name of the language
public void remove formula column at int column index iformula formula get formula at column column index if formula null remove column formula formula column index
remove the formula at the specified index
public void set list renderer list renderer data list renderer this list renderer list renderer
sets the list of renderer
public void set list chart interval list chart interval list chart interval this list chart interval list chart interval
sets the list of chart interval
public void set admin password string admin password this admin password admin password
sets the admins password
public teacher popup menu get teacher popup return teacher popup
returns the teacher popup
public void set teacher popup teacher popup menu teacher popup this teacher popup teacher popup
sets the teacher popup menu
public void set label text string text this label set text text
sets the label bar in the status bar with a text
public void set label icon icon icon this label set icon icon
sets the label bar in the status bar with an icon
public icon get label icon return this label get icon
return the icon contained in the label bar of the status bar
private void add action listener to items print item add action listener new print action listener container copy item add action listener new copy action listener container see item add action listener new see action listener container add formula item add action listener new add formula action listener container
this method add action listener for all item that need one
public jmenu item get add formula item return add formula item
returns the item for adding a formula
public jpopup menu get header jury popup return header jury popup
returns the popup menu for the tables header
public jpopup menu get main jury popup return main jury popup
returns the popup menu for the table
public jmenu item get see item return see item
returns the item for seeing a student
public double get percentage double min double max the number of students that have between min max int sum 0 the total number of students int nb lines 0 for student datas data datas if data is formula nb lines double average get average data if average min average max sum return sum 100 double nb lines
returns the percentage of students which the average is between min and
public void update items with language delete item set text container get language get pop teacher del update item set text container get language get pop update form print item set text container get language get pop teacher print copy item set text container get language get pop teacher copy see item set text container get language get pop teacher see add formula item set text container get language get pop teacher form
update the text of each item when language change
public void show if splash null splash set visible true
shows the splash screen
public void close if splash null splash set visible false
closes the splash screen