input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public string get referenced type if get member instanceof ifield return null ifield field ifield get member return method utils collection type field | the type of object referenced by the collection field if known |
public string get referenced type sig if get member instanceof ifield ifield field ifield get member return method utils to unresolved signature method utils collection type field if get member instanceof imethod imethod accessor method get accessor method if accessor method null return null try return method utils collection type qsig accessor method get return type catch java model exception e todo auto generated catch block e print stack trace return null return null | returns the referenced type signature for the collection |
protected void select in editor body declaration declaration ast utils offset and length offset and length ast utils calculate offset declaration editor util select in editor get editor tracker get editor offset and length offset offset and length length | for use by sublasses |
private void reselect in editor body declaration search declaration if search declaration null return compilation unit parsed compilation unit get editor tracker get parsed compilation unit if parsed compilation unit null return body declaration new declaration ast utils find declaration parsed compilation unit search declaration if new declaration null return select in editor new declaration | locate the method based on its declaration in a previous ast |
private void reselect in editor istructured selection selection hint if selection hint null return abstract node body declaration first element generics as t selection hint get first element reselect in editor first element get declaration | locate the method based the supplied selection hint |
public ievaluated label provider get default label provider return new default evaluated label provider | used whenever there isnt an explicitly provided |
public void move int distance x int distance y m image x distance x m image y distance y | moves the shot entity using distance x and distance y |
public void draw graphics2 d g super draw g try super draw g catch exception e system out print shot entity e get message n system out print shot entity m image x string value of m image x n system out print shot entity m image y string value of m image y n | draws the shot entity |
public int get width return m image w | get the width of the drawn sprite |
private boolean check timer return timer get elapsed time timer interval | checks if the interval for this frame has elapsed |
public boolean image loaded return m image null | returns true if the image associated with this sprite has been loaded |
public int get height return m image h | get the height of the drawn sprite |
public int get x return m image x | returns the current x coordinate of the image |
public void draw graphics2 d g g set paint new texture paint buffered image m image new rectangle 0 t get width get height g fill rect 0 0 get parent width get parent height | draws the next frame |
public int get y return m image y | returns the current y coordinate of the image |
public void increment int amount t amount | increments the background by the specified amount |
protected int get right return get x get width | returns the right coordinate x width of the image |
public int get parent width return parent width | gets the width of the containing frame |
public int get parent height return parent height | gets the height of the containing frame |
protected int get bottom return get y get height | returns the bottom coordinate y height of the image |
public void set parent width int w parent width w | sets the width of the containing frame |
protected void set x int x m image x x | sets the x location of the sprite |
public void set parent height int h parent height h | sets the height of the containing frame |
protected void set y int y m image y y | sets the y location of the sprite |
public void add enemy m enemies add new enemy ship m sprite images get 0 m bounds | adds one enemy to the collection |
public void add enemies int num to add for int i 0 i num to add i m enemies add new enemy ship m sprite images get 0 m bounds | adds a specified number of enemies to the collection |
public void remove enemy int index if index m enemies size 1 throw new index out of bounds exception m enemies remove index | removes an enemy at index |
protected void draw graphics2 d g g draw image m image m image x m image y null | draws the image at the current location |
public void remove all enemies m enemies remove all elements | remove all enemies from the collection |
protected void draw graphics2 d g int x int y m image x x m image y y g draw image m image x y null | draw the sprite onto the graphics context provided |
public int intersects enemy rectangle rct for int i 0 i m enemies size 1 i if m enemies get i intersects with rct return i return 1 | checks if a rectangle intersects any enemy ship in the collection |
public void set location int index point p throw new not implemented exception | sets the location of an enemy ship at index |
public void move shots for int i 0 i shots size 1 i shots get i move 0 1 | moves shots previously created |
public void add shot frame buffered image img shot frames add img | sets a reference to an image to be used as the shot image |
public void set location int x int y boolean check bounds if check bounds if x m bounds x x m bounds x if y m bounds y y m bounds y if x get width m bounds get right x int m bounds get right get width if y get height m bounds get bottom y int m bounds get bottom get height super set location x y | sets the location of the ship entity and optionally checks if it will |
public void set velocity x int vl x m velocity x vl x | sets velocity x |
public void move shots for shot entity se shots se move shot velocity x shot velocity y | moves all shots created by this ship entity |
public void set velocity y int vl y m velocity y vl y | sets velocity y |
public void draw shots graphics2 d g for int i 0 i shots size 1 i shots get i draw g | draws all shots |
public int get velocity x return m velocity x | gets velocity x |
public void cleanup shots for int i 0 i shots size 1 i if shots get i is out of bounds shots remove i | removes any shots that are out of bounds |
public int get velocity y return m velocity y | gets velocity y |
public int get bounding box x return int m bounds get x | gets the internal bounding box location x |
public int get bounding box y return int m bounds get y | gets the internal bounding box location y |
public void set shot velocity x int vl x shot velocity x vl x | sets the velocity x of all shots emitted by this ship entity |
public int get bounding box width return int m bounds get width | gets the internal bounding box width |
public int get bounding box height return int m bounds get height | gets the internal bounding box height |
public void draw graphics2 d g try super draw g catch exception e system out print ship entity e get message n system out print ship entity m image x string value of m image x n system out print ship entity m image y string value of m image y n | attempt to draw at the current location |
protected boolean is out of bounds int r m image x m image w int b m image y m image h if m image x int m bounds get x return true if m image y int m bounds get y return true if r int m bounds get x int m bounds get width return true if b int m bounds get y int m bounds get height return true return false | determines if the ship entity is out of bounds at the current location |
protected boolean is out of bounds int x int y int r x m image w int b y m image h if x int m bounds get x return true if y int m bounds get y return true if r int m bounds get x int m bounds get width return true if b int m bounds get y int m bounds get height return true return false | determines if the ship entity would be out of bounds at the coordinates |
public boolean intersects with entity e int b1 m image x m image h int b2 e get x e get height int r1 m image y m image w int r2 e get y e get width eliminate the possibility of non collision first if b1 e get y return false if m image y b2 return false if r1 e get x return false if m image x r2 return false return true | finds out if this instance intersects with another instance of entity |
public boolean intersects with rectangle rct int b1 m image x m image h int b2 int rct get x rct get height int r1 m image y m image w int r2 int rct get y rct get width eliminate the possibility of non collision first if b1 rct get y return false if m image y b2 return false if r1 rct get x return false if m image x r2 return false return true | finds out if this instance intersects with a rectangle |
public void draw graphics2 d g try super draw g catch image not loaded exception e e print stack trace | draws the entity |
public int get right return int get width get x | gets the right x width of the bounds rect |
public int get bottom return int get height get y | gets the bottom of the bounds rect |
public void open shell shell new shell get parent get style create contents shell display display get parent get display shell set size 275 240 int x get parent get bounds x get parent get bounds width shell get bounds width 2 int y get parent get bounds y get parent get bounds height shell get bounds height 2 shell set location x y shell open while shell is disposed if display read and dispatch display sleep | the open function of a dialog class |
public employee open shell shell new shell get parent get style if employee null shell set text add a new employee else shell set text edit employee getemployeename create contents shell shell set size 255 338 int x get parent get bounds x get parent get bounds width shell get bounds width 2 int y get parent get bounds y get parent get bounds height shell get bounds height 2 shell set location x y shell open display display get parent get display while shell is disposed if display read and dispatch display sleep return employee | the open method of a dialog class |
public void setemployee employee employee this employee employee | set the employee information of this dialog |
private int skill id to table index int skill id if productivity table get item count 0 for int i 0 i productivity table get items length i if productivity table get item i get text 0 equals all basic data skills skill id return i return 1 else return 1 | giving a skill id find its index in the productivity table |
public void fill output output output this output output | fill the output with new output data |
private void create contents final shell shell shell set layout new fill layout new chart composite shell swt none generate chart create dataset true | create all the contents |
public void initialize list task tasks task terminal task null for task t tasks initialize and get the terminal task if t is terminal prepriority put t 0 terminal task t else prepriority put t 1 compute prepriority terminal task compute all the prepriorities int max 0 for task t tasks if max prepriority get t max prepriority get t max preriority max for task t tasks if prepriority get t 1 prepriority put t max | initialize every time |
private void compute prepriority task task if task get pre tasks size 0 set task pretasks task get pre tasks key set for task pre task pretasks int length prepriority get task 1 if prepriority get pre task null length prepriority get pre task prepriority put pre task length compute prepriority pre task | compute all the prepriorities we must pass the terminal task as the parameter |
public void run display display new display shell shell new shell display swt min swt close shell set text gsd task allocation system create contents shell shell set size 520 600 shell set location 200 200 shell open while shell is disposed if display read and dispatch display sleep dispose images dispose threads display dispose | the run function |
private int link cost string site1 string site2 boolean sync if main gui get app get cost map get site1 site2 null if sync return main gui get app get cost map get site1 site2 0 else return main gui get app get cost map get site1 site2 1 else return 0 | the cost to maintain a link between two sites |
private void dispose images if add null add dispose add null if delete null delete dispose delete null if terminal null terminal dispose terminal null | dispose image resources after the window closed |
private int message cost string site1 string site2 boolean sync if main gui get app get cost map get site1 site2 null if sync return main gui get app get cost map get site1 site2 2 else return main gui get app get cost map get site1 site2 3 else return 0 | the cost to send a message |
private void dispose threads for thread thread all threads if thread null thread stop | dispose all employee threads |
private float culture difference employee employee1 employee employee2 dimension dimension1 dimension2 dimension1 all basic data culture value employee1 get country dimension2 all basic data culture value employee2 get country int pdi diff dimension1 pdi dimension2 pdi pdi diff pdi diff 0 pdi diff pdi diff int idv diff dimension1 idv dimension2 idv idv diff idv diff 0 idv diff idv diff int uai diff dimension1 uai dimension2 uai uai diff uai diff 0 uai diff uai diff float culturedifference pdi diff idv diff uai diff 300 0f return culturedifference | the culture differences between two employees |
private float vc task pre task employee employee1 task task employee employee2 if employee1 employee2 return 0 0f float complete time pre task get size employee1 get productivity get pre task get task type the cost of employee1 to complete the pre task float pc complete time employee1 get salary float cc cc pre task employee1 task employee2 float vc 0 075f pc cc 0 7f 1 culture difference employee1 employee2 return vc | the vulnerability cost |
public float communication cost task pre task employee employee1 task task employee employee2 float dependency return dependency cc pre task employee1 task employee2 vc pre task employee1 task employee2 | this function is used to calculate the communication between employee1 and employee 2 |
public void modify anemployee employee employee int index employees set index employee employees table set redraw false table item item employees table get item index item set text 1 employee getemployeename item set text 2 employee getemployeedescription item set text 3 employee get salary item set text 4 all basic data time zones employee get time zone item set text 5 all basic data countries employee get country replace item set text 6 employee get productivity string item set text 7 employee get role string employees table set redraw true | modify an employee item in the employees table |
public task open shell shell new shell get parent get style if task null shell set text add a new task else shell set text edit task get name create contents shell shell pack int x get parent get bounds x get parent get bounds width shell get bounds width 2 int y get parent get bounds y get parent get bounds height shell get bounds height 2 shell set location x y shell open display display get parent get display while shell is disposed if display read and dispatch display sleep return task | the open method which a dialog class must implement |
public string get productivity string string pd str if productivity size 0 for integer key productivity key set float value productivity get key pd str all basic data skills key value return unget pd str | get a single simple string format of the skill and its productivity |
private string unget string str if str is empty return str else return str substring 0 str length 1 | remove the last comma if necessary |
public string get role string string role str if roles size 0 for integer index roles role str all basic data roles index return unget role str | get a single simple string format of the roles |
public void open shell shell new shell get parent get style int x get parent get bounds x get parent get bounds width int y get parent get bounds y shell set location x y create contents shell shell pack shell open display display get parent get display while shell is disposed if display read and dispatch display sleep | the open function of a dialog class |
public void set cost cost cost this cost cost | set the cost entity this dialog will edit |
public void add atask task task tasks add task int n tasks table get item count new table item tasks table swt none if task is terminal reset all n reload task table data | add a task item to the tasks table |
public void open shell shell new shell get parent get style shell set text task graph create contents shell shell open display display get parent get display while shell is disposed if display read and dispatch display sleep | the open function of a dialog class |
private void create contents final shell shell shell set layout new fill layout new chart composite shell swt none generate chart true | create all the contents |
private void create contents final shell shell display tasks shell | create all of the contents controls on this window |
public void modify atask task task int index tasks set index task tasks table set redraw false table item item tasks table get item index item set text 1 task get name item set text 2 task get description item set text 3 task get size item set text 4 all basic data skills task get task type item set text 5 all basic data roles task get role if task is terminal reset all index reload task table data tasks table set redraw true | modify a task item in the tasks table |
private void create images final shell shell display device shell get display try add new image device add gif delete new image device delete gif terminal new image device stop png catch exception ept dispose images | create necessary images for some controls |
private void compute prepriority task task if task get pre tasks size 0 for task pre task task get pre tasks int length prepriority get task 1 if prepriority get pre task null length prepriority get pre task prepriority put pre task length compute prepriority pre task | compute all the prepriorities we must pass the terminal task as the parameter |
public float communication cost task pre task employee employee1 task task employee employee2 float dependency return cc pre task employee1 task employee2 vc pre task employee1 task employee2 | this function is used to calculate the communication between employee1 and employee 2 |
public void open shell shell new shell get parent get style shell set text basic data create contents shell display display get parent get display shell set size 275 240 int x get parent get bounds x get parent get bounds width shell get bounds width 2 int y get parent get bounds y get parent get bounds height shell get bounds height 2 shell set location x y shell open while shell is disposed if display read and dispatch display sleep | the open function of a dialog class |
public void set rw float value rw value | set the value of rw |
public void set pr float value pr value | set the value of pr |
public void set es float value es value | set the value of es |
public void set ea float value ea value | set the value of ea |
public void initialize list task tasks task terminal task null for task t tasks initialize and get the terminal task if t is terminal prepriority put t 0 terminal task t else prepriority put t 1 compute prepriority terminal task compute all the prepriorities int max 0 for task t tasks if max prepriority get t max prepriority get t max preriority max for task t tasks if prepriority get t 1 prepriority put t max system out println rw rw | initialize every time |
private float delta cost task pre task employee employee1 task task employee employee2 return this ct pre task employee1 task employee2 employee1 get salary employee2 get salary | the cost that will be spent when they are communicating |
private void create tabs final shell shell tab folder new ctab folder shell swt top tab folder set border visible true create tasks tab shell create employees tab shell create cost tab shell tab folder set selection 0 | create the tab folder of the shell |
private float pu employee employee1 employee employee2 if employee1 get country employee2 get country in the same site return 0 1f else if employee1 get time zone employee2 get time zone different site with the same timezone return 0 3f else in different sites with different timezone return 0 7f | the probability that a message can be unclear |
private float vc task pre task employee employee1 task task employee employee2 if employee1 employee2 return 0 0f float complete time pre task get size employee1 get productivity get pre task get task type the cost of employee1 to complete the pre task float pc complete time employee1 get salary float cc cc pre task employee1 task employee2 float vc this pu employee1 employee2 this pr this rw pc cc return vc | the vulnerability cost |
public float communication cost task pre task employee employee1 task task employee employee2 return cc pre task employee1 task employee2 vc pre task employee1 task employee2 | this function is used to calculate the communication between employee1 and employee 2 |
private void create images final shell shell display device shell get display try add new image device get class get resource as stream add gif delete new image device get class get resource as stream delete gif terminal new image device get class get resource as stream stop png catch exception ept dispose images | create necessary images for some controls |
private void reset all status if tasks null employees null return reset all tasks status for task task tasks task set allocated false task set assignedemployee null task set completion time null null task set finished false reset all employees status for employee employee employees employee set available true scheduled tasks clear schedule pairs clear progress set selection 0 output label set text this dispose threads all threads clear | reset all scheduling status thus another running can be done |
private void adjust with base constraints int n scheduled tasks size for int i 0 i n i adjust with dependcy constraint i | adjust the tasks with base constraints include dependency constraints and human resource constraints |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.