input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public void example invalid while int a 1 int b 2 int c 1024 violation while a c a a b violation while a b violation while a c a a b | violating use of an while statement |
public void example valid if else int a 1 int b 1 boolean ok false if a b b a ok true else ok false | correct use of an if else statement |
public void example invalid if else int a 1 int b 1 boolean ok false violation if a b b a ok true else violation ok false if a b b a ok true else violation ok false if a b b a ok true else violation ok false if a b b a ok true violation else ok false | violating use of an if else statement |
public void example valid try catch try int result 7 0 catch exception ex ex print stack trace | correct use of an if else statement |
public void example invalid try catch violation try int result 7 0 catch exception ex violation ex print stack trace try int result 7 0 catch exception ex violation ex print stack trace try int result 7 0 catch exception ex violation ex print stack trace | violating use of an if else statement |
public void test decrypt message idecrypter decrypter xordecrypter get instance venky dude string buffer message buffer new string buffer 1 e message buffer append char 30 0 c message buffer append char 12 32 message buffer append char 50 string message message buffer to string string decrypted message decrypter decrypt message assert assert equals decrypted message hi | test decrypt message with message 1 e 0 c 32 |
public void test decrypte empty message idecrypter decrypter xordecrypter get instance venky dude string decrypted message decrypter decrypt assert assert equals decrypted message | test decrypt message with empty message |
public void test decrypt message twice idecrypter decrypter xordecrypter get instance venky dudue string message this is a random message string decrypted message decrypter decrypt message decrypted message decrypter decrypt decrypted message assert assert equals message decrypted message | test decrypting a message twice |
public void reset int count 0 tile panel remove all group new button group tile button b new tile button null tile panel add b group add b count iterator i gfx iterator while i has next b new tile button tile i next tile panel add b group add b count if count 0 spacer set text no tiles spacer set preferred size new dimension 1 100 spacer set border new line border color black else spacer set text drop new tiles spacer set preferred size new dimension 1 30 tile panel revalidate repaint | rebuild the entire panel from the graphics bank |
public void tileset updated graphics bank g system out println tilset updated if g gfx reset | large change to the tileset so we just remove |
public void set effect float r float g float b float h float s float z system out println scene set effect called will call for the gfx bank r r g g b b z z effect r scale r effect g scale g effect b scale b effect hue h effect sat s tileset set effect r g b h s z map set zoom z | apply rgb scalars and hue sat adjustments to the tiles and characters |
public boolean is unsaved if get file null return true return is unsaved | true if there have been any changes to the tileset since it |
public void tile added graphics bank g tile t system out println tilset updated tile button b new tile button t tile panel add b group add b spacer set text drop new tiles spacer set preferred size new dimension 1 30 tile panel revalidate repaint | add a single tile button |
public void fire change event graphics bank change listener l iterator i change listeners iterator while i has next l graphics bank change listener i next l tileset updated this | may be called directly and will cause |
public void render graphics g int offset x int offset y g set color color black g fill rect int x 5 offset x int y 5 offset y 100 100 | render this sprite to the graphics |
public void logic | override this method to update ai |
private void fire add event tile t system out println fire add event graphics bank change listener l iterator i change listeners iterator while i has next l graphics bank change listener i next l tile added this t | called whenever a tile is added using add |
private void fire remove event tile t graphics bank change listener l iterator i change listeners iterator while i has next l graphics bank change listener i next l tile removed this t | called whenever a tile is removed using remove |
public void logic if track sprite null trackingx track sprite get x trackingy track sprite get y speedx trackingx viewx floatiness speedy trackingy viewy floatiness speedx speedx 94f speedy speedy 94f viewx speedx viewy speedy | override this method to update ai |
public boolean can import jcomponent comp data flavor transfer flavors system out println got query by component comp for int i 0 i transfer flavors length i system out println available flavor transfer flavors i if transfer flavors i equals data flavor java file list flavor system out println i can use this return true return false | determine whether we can or cannot accept the stuff the user is dragging |
public boolean equals object o if o instanceof control sort s sort o if name s name return true else if name null s name null return false else return name equals s name return false | equals on name only |
public void validate bigraph bigraph throws undefined port exception undefined control exception atomic control exception place type exception child sort exception control index exception signature validate bigraph validate bigraph get roots null null | validate a model against this sorting only |
protected boolean check integer long value map string variable definition variables map string object variable values todo long only version return check real double value variables variable values | check constraints on integer |
public boolean is atomic return status status atomic | is atomic status atomic only |
public control get control string control name if control name null return null for control control controls if control name equals control get name return control return null | get control by name |
public void validate bigraph bigraph throws undefined port exception undefined control exception atomic control exception place type exception control index exception validate bigraph get roots true bigraph get variables | validate a model against this signature only |
public boolean equals object o if o instanceof control control c control o if name c name return true else if name null c name null return false else return name equals c name return false | equals on name only |
public reactive bigraph get reactive bigraph return reactive bigraph | get reactive bigraph with which this is associated |
private int count link occurrences element element string pattern link int count 0 named node map attributes element get attributes for int ai 0 ai attributes get length ai string value attributes item ai get node value if value equals pattern link count node list children element get child nodes for int ci 0 ci children get length ci node child children item ci if child instanceof element count count link occurrences element child pattern link return count | cound link occurances |
private void next match dom part match part match int target ixs next for int i 0 i part match node matches size i target ixs i dom part match node match part node match part match node matches get i if target ixs i part node match target els size if i 1 part match node matches size target ixs i 0 else break | update index es in match generation loop |
protected boolean find hole index element hole element node int next index if hole node return true if this is hole node next index 0 list element child els this get children node for element child el child els depth first if find hole index hole child el next index return true return false | deduce index by walking tree depth first and counting holes |
public void write file output file throws transformer configuration exception transformer exception xml utils write file document output file | write to xml file |
protected place get selected place selected place list object selections selection get selections if selections size 1 joption pane show message dialog frame select exactly one place error joption pane error message return null if selections get 0 instanceof place return place selections get 0 joption pane show message dialog frame select exactly one place error joption pane error message return null | place in which to insert |
public void mouse clicked mouse event me if me get button me button1 if me is shift down selection clear object object get bigraph element at me get x me get y if object null logger debug selected object selection add object repaint | canvas interaction mouse event |
protected object get bigraph element at int x int y object object null for place view root view root views rectangle2 d bounds root view get bounds object get bigraph element at root view x y object if object null return object return object | find a bigraph element at near a mouse location |
public void mouse entered mouse event arg0 todo auto generated method stub | canvas interaction mouse event |
public void mouse exited mouse event arg0 todo auto generated method stub | canvas interaction mouse event |
public void mouse pressed mouse event arg0 todo auto generated method stub | canvas interaction mouse event |
public void mouse released mouse event arg0 todo auto generated method stub | canvas interaction mouse event |
public void initialise from json object map properties todo if properties contains key property line width set line width integer properties get property line width todo color | initialise from parsed json |
public point2 d get port location rectangle2 d outer bounds int index int arity point2 d port location if port location null port location new point double ratio index 0 5 arity port location set location get port width outer bounds get width 2 get port width ratio this get letter height get port width 2 return port location | get port location in local coordinates default is along top edge |
public point2 d get port normal rectangle2 d outer bounds int index int arity point2 d port normal if port normal null port normal new point port normal set location 0 1 return port normal | get port wire default away direction |
protected element get selected place selected place list object selections selection get selections if selections size 1 joption pane show message dialog frame select exactly one place error joption pane error message return null if selections get 0 instanceof element return element selections get 0 joption pane show message dialog frame select exactly one place error joption pane error message return null | place in which to insert |
protected void update borders minimum width top 3 image height get letter height minimum width left minimum width right 3 image width 2 | calculate set borders |
protected boolean find port point info pi linked list place view root views java awt point origin new java awt point for place view root view root views if find port pi root view origin return true return false | find port and position |
public string write to string bigraph bigraph throws ioexception char array writer caw new char array writer write bigraph caw caw flush return caw to string | write to string buffer |
public void write bigraph bigraph file file throws ioexception file output stream fos new file output stream file write bigraph fos fos close | write to file |
public void write bigraph bigraph output stream os throws ioexception write bigraph new output stream writer os charset null charset ioconstants default charset | write to io stream |
protected void check state for update string operation if state state active state state changed throw new bigraph runtime exception cannot perform operation in state state if mode mode readwrite throw new bigraph runtime exception cannot perform operation in mode mode | helper check state for update else throw exception |
public bigraph read string text throws ioexception sorting exception return read new string reader text | read from string |
protected void check state for read string operation if state state active state state changed throw new bigraph runtime exception cannot perform operation in state state | helper check state for update else throw exception |
public bigraph read file file throws ioexception sorting exception file input stream fis new file input stream file bigraph bigraph read fis fis close return bigraph | read from io stream |
public bigraph read input stream is throws ioexception sorting exception return read new input stream reader is charset null charset ioconstants default charset | read from io stream |
protected void validate bigraph bigraph throws sorting exception if this validating return if signature null signature validate bigraph if sorting null sorting validate bigraph | useful method s to validate if required |
protected void load signature jfile chooser chooser new jfile chooser chooser set dialog title load signature int return val chooser show open dialog frame if return val jfile chooser approve option return try file f chooser get selected file logger debug reading signature file f basic signature signature factory read signature f bigraph set signature basic signature place renderer configuration initialise from json object o this catch exception e logger error reading signature e joption pane show message dialog frame e to string error reading signature joption pane error message | load signature swing thread |
public performance results get performance results return m perf results | gets the performance results |
public throughput results get throughput results return m throughput results | gets the throughput results |
public void add throughput result point int i users double d throughput m throughput results add result point new result point i users d throughput | adds a throughput result point |
public void make perf result point m perf results make result point | signals the contained performance results to make a result point |
public void run do the pre run pre run m pre done release start with other users for the main run try m start signal acquire catch interrupted exception e e print stack trace run the test do run tell the countdown barrier i m done m done release do the post run try m post begin acquire catch interrupted exception e e print stack trace post run m post done release | this method behaves differently on each run |
public solution get solution return solution | returns solution to this problem |
public boolean is solver proper solver solver return false | checks if given solver is proper for this problem solving |
private void log results list results string file regexp match regexp match for iterator iterator results iterator iterator has next regexp match regexp match iterator next logger log file regexp match get line number regexp match get regexp pattern get description logger debug file match string format match regexp match get match string | log the results in a neat format |
public list match throws file not found exception collection regexp patterns get all patterns list failures new array list regexp pattern pattern for iterator iterator regexp patterns iterator iterator has next pattern regexp pattern iterator next if pattern get regexp index of custom pattern separator 1 match pattern within pattern pattern failures else match single pattern pattern failures return failures | perform the parsing of all relevant regular expressions for the given source |
protected list match regexp string regexp string source string pattern include get compiled pattern regexp pattern matcher input input new pattern matcher input source string pattern matcher include matcher new perl5 matcher list match results new array list while include matcher contains input include match results add include matcher get match return match results | perform the matching for a particular regexp on the file |
private pattern get compiled pattern string regexp try return new perl5 compiler compile regexp get compiler options catch malformed pattern exception e throw new illegal argument exception malformed regular expression regexp | gets a compiled representation of the regexp pattern |
private boolean log results list results string file throws jspchecker exception if results is empty return false else regexp match regexp match formatter formatter formatter factory get formatter get formatter formatter start get output file for iterator iterator results iterator iterator has next regexp match regexp match iterator next if string utils is empty get output file formatter out file regexp match get line number regexp match log file regexp match get line number regexp match get regexp pattern get description formatter close illegal matches results size return true | log the results in a neat format |
protected void setze position int x int y symbol setze position x y this x x this y y | setzt position des bildes |
public task status find string id entity transaction tx begin transaction task status status get entity manager find task status class id if status null status new task status id get entity manager persist status get list add status commit and notify tx else tx commit return status | gets a task status by id |
public task dependency model get dependency model return dependency model | p getter for the field code dependency model code |
protected jpanel create completion panel jfree chart chart create chart completion data set task completion return new chart panel chart | creates a panel for the demo used by super demo |
protected jpanel create priority panel jfree chart chart create chart priority data set task priority return new chart panel chart | creates a panel for the demo used by super demo |
public boolean is urgent return this urgent | p is urgent p |
public task set title string name this name name return this | sets the name of the task |
public task set due date date due date this due date due date return this | sets the tasks due date |
public task set start date date start date this start date start date return this | sets the tasks start date |
protected table property get property int index return properties index | p get property p |
public method get getter return this getter | p getter for the field code getter code |
public method get setter return this setter | p getter for the field code setter code |
public task set status task status status if status null closed equals status get id for task dependency dep get right dependencies if closed equals dep get left get status get id throw new illegal state exception task dep get left get id must be completed before get id this status status return this | task status setter |
public boolean is readable return get getter null | p is readable p |
public boolean is writable return get setter null | p is writable p |
public boolean is fatal return fatal | returns value of fatal |
public record get record throws exception if filters null throw new java lang exception pipeline not set up correctly prior to call to get record return filters get record | default behavior is to deligate get record to the last filter in the |
public record peek throws invalid record exception throw new invalid record exception peek has not been implemented in the concrete records file | to get the next record to be processed |
public void create record class string record class name throws invalid record exception this record class name record class name try this record class class for name record class name this record class new instance catch exception e logger log level severe could not create new instance of record class name e throw new invalid record exception fatal e get class get name e get message true | set the class name of the records contained in this file object |
public string get record class name return this record class name | return the class name of records contained in this file object |
private void set source record records throws illegal argument exception this clear records this file based false for object o records if o null continue if record class is instance o throw new illegal argument exception invalid record expected record class name found o get class get name if records length 0 this eof true this records records | set the records contained in this records file object |
private void set source string filename throws illegal argument exception this filename filename this file based true try this handle new buffered reader new file reader filename read record string catch ioexception ioe throw new illegal argument exception could not get file reader for filename ioe | set source to a file |
public void clear records records null current index 0 | clear records vector and reset current index |
public boolean valid string s if s matches acgturykmswbdhvnacgturykmswbdhvn return true if s matches s acgturykmswbdhvnacgturykmswbdhvn d return true return false | a adenosine m a c amino |
public void reset source throws illegal argument exception eof false if file based try handle close catch ioexception ioe logger log level warning could not close filename ioe handle null this set source filename else if records length 0 this eof true current index 0 | to reset the source to the beginning of the input |
public string remove spaces digits string s string sp if valid s true for int i 0 i s length i char c s char at i if valid c sp c return sp | remove spaces digits string s take a string like |
public string get string key return prop get property key | gets the value of the property |
public string rip off start token string line string token throws parse exception if line starts with token return line substring token length trim else throw new parse exception line token token length | rip off start token |
public boolean is file based return this file based | return the value fo the file based class variable |
public string rip off end token string line string token throws parse exception if line ends with token return line substring 0 line length token length trim else throw new parse exception line token token length | rip off end token |
protected string read record string throws invalid record exception string old record string null if current record string null old record string current record string string empty string try while current record string handle read line null current record string trim equals empty string skip current record string if current record string null eof true catch ioexception e throw new invalid record exception e get message true return old record string | to read a line from the file when file based |
public void run try input stream reader isr new input stream reader is buffered reader br new buffered reader isr string line null while line br read line null this buffer append line n br close br null catch ioexception ioe logger log level severe problem reading stdout or stdin from process ioe | process the input stream in this thead |
public string get unique file name string ext try return get process id get date time ext catch exception ex logger get logger process util class get name log level severe null ex return null | get unique file name takes an extension e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.