input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public void set clip bounds order bounds graphics g this get graphics g set clip bounds get left bounds get top bounds get right bounds get left bounds get bottom bounds get top this top bounds get top this left bounds get left this right bounds get right this bottom bounds get bottom
|
set clipping boundaries for canvas based on a bounds order
|
public void register cache cache cache orders cache cache
|
set current cache
|
public void move pointer int x int y need java 1 3 to move mouse with robot
|
move the mouse pointer only available in java 1
|
private int twos complement16 int val return val 0x8000 0 val 0x ffff 1 val
|
interpret an integer as a 16 bit twos complement number based on its
|
public void draw line order line order line int x1 line get start x int y1 line get start y int x2 line get end x int y2 line get end y int fgcolor line get pen get color int opcode line get opcode 1 draw line x1 y1 x2 y2 fgcolor opcode
|
draw a line to the screen
|
public void draw pat blt order pat blt order patblt brush brush patblt get brush int x patblt get x int y patblt get y if x this right y this bottom return off screen int cx patblt get cx int cy patblt get cy int fgcolor patblt get foreground color int bgcolor patblt get background color int opcode patblt get opcode pat blt order opcode x y cx cy fgcolor bgcolor brush
|
perform a pattern blit on the screen
|
public void draw rectangle order rectangle order rect if logger is info enabled logger info rectangle order fill rectangle rect get x rect get y rect get cx rect get cy rect get color
|
draw a rectangle to the screen
|
public void set pixel int opcode int x int y int color int bpp options bpp correction for 24 bit colour if bpp 3 color color 0x ff 16 color 0x ff00 color 0x ff0000 16 if x this left x this right y this top y this bottom clip else rop do pixel opcode backstore x y color
|
perform an operation on a pixel in the backstore
|
public void lost focus if input null input lost focus
|
handle the window losing focus notify input classes
|
public void gained focus if input null input gained focus
|
handle the window gaining focus notify input classes
|
public void trigger ready to send input trigger ready to send
|
notify the input classes that the connection is ready for sending
|
public int get freq return n get freq pointer
|
gets the audio frequency in samples per second
|
public void set freq int f n set freq pointer f
|
sets the audio frequency in samples per second
|
public int get format return n get format pointer
|
gets the audio data format
|
public void set format int f n set format pointer f
|
sets the audio data format
|
public byte get channels return n get channels pointer
|
gets the number of channels
|
public void set channels byte c n set channels pointer c
|
gets the number of channels
|
public byte get silence return n get silence pointer
|
gets the audio buffer silence value calculated
|
public void set silence byte s n set silence pointer s
|
sets the audio buffer silence value
|
public short get samples return n get samples pointer
|
gets the audio buffer size in samples
|
public void set samples short s n set samples pointer s
|
sets the audio buffer size in samples
|
public int get size return n get size pointer
|
gets the audio buffer size in bytes calculated
|
public void set size int s n set size pointer s
|
sets the audio buffer size in bytes br
|
protected void audio callback audio stream s check if we have a listener if get audio stream listener null get audio stream listener fill audio s
|
function used to deliver the stream back to the listener
|
protected void build feed metadata map model t feed http servlet request request
|
populate the feed metadata title link description etc
|
public void set feed type string feed type this feed type feed type
|
sets the rome feed type to use
|
public void set pet pet pet this pet pet
|
setter for property pet
|
public void set drop location resource test drop location this drop location test drop location
|
sets the location of the file containing the drop scripts for the database
|
public void populate resource sql file connection connection null try connection data source get connection try string sql parse sql in sql file execute sql sql connection catch ioexception e throw new runtime exception i o exception occurred accessing the database schema file e catch sqlexception e throw new runtime exception sql exception occurred exporting database schema e catch sqlexception e throw new runtime exception sql exception occurred acquiring connection e finally if connection null try connection close catch sqlexception e
|
populate the database executing the statements in the provided resource against the database
|
public void save motorist motorist motorist map string string parameters new hash map string string parameters put email motorist get email parameters put password motorist get password parameters put first name motorist get first name parameters put last name motorist get last name get named parameter jdbc template update motorist insert parameters
|
saves a motorist object using springs named parameter jdbc template
|
public void save motorist motorist motorist get jdbc template update motorist insert new object motorist get email motorist get password motorist get first name motorist get last name motorist set id query for identity
|
saves a motorist using springs jdbc template
|
public void save motorist motorist motorist connection conn null prepared statement stmt null try conn data source get connection stmt conn prepare statement motorist insert stmt set string 1 motorist get email stmt set string 2 motorist get password stmt set string 3 motorist get first name stmt set string 4 motorist get last name stmt execute catch sqlexception e deal with exception somehow finally try stmt close conn close catch sqlexception e
|
inserts a motorist to the database using conventional e
|
public void update motorist motorist motorist connection conn null prepared statement stmt null try conn data source get connection stmt conn prepare statement motorist update stmt set string 1 motorist get email stmt set string 2 motorist get password stmt set string 3 motorist get first name stmt set string 4 motorist get last name stmt set int 5 motorist get id stmt execute catch sqlexception e deal with exception somehow finally try if stmt null stmt close if conn null conn close catch sqlexception e
|
updates a motorist object in the database using convention e
|
public motorist get motorist by id long id list matches get jdbc template query motorist by id select new object long value of id new row mapper public object map row result set rs int row num throws sqlexception data access exception motorist motorist new motorist motorist set id rs get int 1 motorist set email rs get string 2 motorist set password rs get string 3 motorist set first name rs get string 4 motorist set last name rs get string 5 return motorist return matches size 0 motorist matches get 0 null
|
retrieves a motorist by its id
|
public motorist get motorist by id long id list motorist matches get simple jdbc template query motorist by id select new parameterized row mapper motorist public motorist map row result set rs int row num throws sqlexception motorist motorist new motorist motorist set id rs get int 1 motorist set email rs get string 2 motorist set password rs get string 3 motorist set first name rs get string 4 motorist set last name rs get string 5 return motorist id return matches size 0 matches get 0 null
|
retrieves a motorist from the database using springs simple jdbc template
|
public void send email for vehicle vehicle vehicle motorist motorist vehicle get motorist if motorist null return simple mail message message new simple mail message mail message message set to motorist get email string text message get text text string utils replace text state vehicle get state text string utils replace text plate vehicle get plate number message set text text mail sender send message
|
sends an e mail to tell a motorist that they have new rants
|
public void send daily rant emails list rant rants for today get rants for day new date set vehicle vehicles ranted about today new hash set vehicle extract vehicles and place into set for uniqueness for rant rant rants for today vehicles ranted about today add rant get vehicle for vehicle vehicle vehicles ranted about today send email for vehicle vehicle
|
sends a daily e mail to motorists who have been ranted about
|
public void init servlet config config get servlet config greeting config get init parameter greeting if greeting null greeting hello world
|
this method is called once by the container when the servlet is
|
public void destroy greeting null
|
this method is called once by the container just before the servlet
|
public void set news item news item bean news item synchronized id sequence news item set id id sequence 0 synchronized news items news items add news item
|
adds a news item to the list
|
public void set answer answer bean answer total string answer id answer get answer id if answer id equals 1 answer1 else if answer id equals 2 answer2 else if answer id equals 3 answer3
|
increments the counter matching the answer as well
|
public void remove news item int id synchronized news items for int i 0 i news items size i news item bean item news item bean news items get i if id item get id news items remove i break
|
removes the news item with the specified id
|
private void add default items news item bean item new news item bean item set category jsp item set msg 2nd edition of o reilly jsp book released item set posted by hans bergsten set news item item item new news item bean item set category servlet item set msg servets and jsp a powerful duo item set posted by hans bergsten set news item item item new news item bean item set category ejb item set msg jsp makes a great front end for ejb item set posted by hans bergsten set news item item
|
creates sample news items and adds them to the list
|
public string get dept return dept
|
returns the dept property value
|
public int get answer1 return answer1
|
returns the number of alternative 1 answers
|
public void set dept string dept this dept dept
|
sets the dept property value
|
public date get emp date return emp date
|
returns the emp date property value
|
public int get answer2 return answer2
|
returns the number of alternative 2 answers
|
public void set emp date date emp date this emp date emp date
|
sets the emp date property value
|
public int get answer3 return answer3
|
returns the number of alternative 3 answers
|
public string get email addr return email addr
|
returns the email addr property value
|
public void set email addr string email addr this email addr email addr
|
sets the email addr property value
|
public int get answer1 percent return get percent total answer1
|
returns the percentage of alternative 1 answers
|
public string get answer id return answer id
|
returns the answer id property value
|
public int get answer2 percent return get percent total answer2
|
returns the percentage of alternative 2 answers
|
public void set answer id string answer id this answer id answer id
|
sets the answer id property value
|
public boolean is valid boolean is valid false if answer id null is valid valid ids index of answer id 1 return is valid
|
returns true if the answer id matches one of
|
public int get answer3 percent return get percent total answer3
|
returns the percentage of alternative 3 answers
|
public void set projects string projects if projects null this projects null else this projects arrays as list projects
|
sets the projects property value
|
public void set msg string msg this msg msg
|
sets the msg property value
|
private int get percent int total int answer return int math round double answer double total 100
|
returns an int representing the rounded percentage of
|
public void set posted by string posted by this posted by posted by
|
sets the posted by property value
|
public date get posted date return posted date
|
returns the posted date property value
|
public void set sql value string sql value this sql value sql value
|
set the sql string possibly with question mark placeholders for
|
public map get headers if page context null throw new illegal state exception the page context property is not set map info new hash map http servlet request req http servlet request page context get request enumeration names req get header names while names has more elements string name string names next element enumeration values req get headers name string buffer sb new string buffer boolean first true while values has more elements if first sb append first false sb append values next element info put name sb to string return info
|
returns a map with all header information
|
public void set values list values this values values
|
sets the values to use for the place holders in the sql
|
public string get birth date return birth date null birth date
|
returns the birth date property value
|
public result execute query throws sqlexception result result null result set rs null prepared statement pstmt null statement stmt null try if values null values size 0 use a prepared statement and set all values pstmt conn prepare statement sql value set values pstmt values rs pstmt execute query else use a regular statement stmt conn create statement rs stmt execute query sql value result result support to result rs finally if rs null try rs close catch sqlexception e if stmt null try stmt close catch sqlexception e if pstmt null try pstmt close catch sqlexception e return result
|
executes the specified sql string as a query and returns
|
public map get cookies if page context null throw new illegal state exception the page context property is not set map info new hash map http servlet request req http servlet request page context get request cookie cookies req get cookies if cookies null for int i 0 i cookies length i info put cookies i get name cookies i get value return info
|
returns a map with all cookie information
|
public boolean is birth date valid boolean is valid false if birth date null string format is valid date birth date date format pattern is valid true return is valid
|
validates the birth date property
|
public map get params if page context null throw new illegal state exception the page context property is not set map info new hash map http servlet request req http servlet request page context get request enumeration names req get parameter names while names has more elements string name string names next element string values req get parameter values name string buffer sb new string buffer for int i 0 i values length i if i 0 sb append sb append values i info put name sb to string return info
|
returns a map with all request parameter information
|
public string get email addr return email addr null email addr
|
returns the email addr property value
|
public void save employee employee bean emp info throws sqlexception save the user info from the database connection conn data source get connection conn set auto commit false try save single value props emp info conn save projects emp info conn conn commit catch sqlexception e conn rollback finally try conn set auto commit true conn close catch sqlexception e ignore
|
inserts the information about the specified employee or
|
public map get request scope if page context null throw new illegal state exception the page context property is not set map info new hash map http servlet request req http servlet request page context get request enumeration names req get attribute names while names has more elements string name string names next element object value req get attribute name info put name to string value value return info
|
returns a map with all request scope variables
|
public boolean is email addr valid boolean is valid false if email addr null string format is valid email addr email addr is valid true return is valid
|
validates the email addr property
|
public void set food string food this food food
|
sets the food property value
|
public map get page scope if page context null throw new illegal state exception the page context property is not set map info new hash map enumeration names page context get attribute names in scope page context page scope while names has more elements string name string names next element object value page context get attribute name info put name to string value value return info
|
returns a map with all page scope variables
|
public boolean is food valid boolean is valid false if food null string format is valid string food food list true is valid true return is valid
|
validates the food property
|
public map get session scope if page context null throw new illegal state exception the page context property is not set map info new hash map http servlet request req http servlet request page context get request http session session req get session enumeration names session get attribute names while names has more elements string name string names next element object value session get attribute name info put name to string value value return info
|
returns a map with all session scope variables
|
public boolean is pizza selected return is food type selected z
|
returns true if the food property includes the marker for
|
public boolean is pasta selected return is food type selected p
|
returns true if the food property includes the marker for
|
public void set product product bean product if product null cart index of product 1 cart add element product
|
adds a product to the cart if its not already there
|
public map get products by id return catalog
|
returns a map with all product bean instances keyed by id
|
public float get total float total 0 iterator prods cart iterator while prods has next product bean product product bean prods next float price product get price total price return total
|
returns the total price for all products in the cart
|
public map get application scope if page context null throw new illegal state exception the page context property is not set map info new hash map servlet context context page context get servlet context enumeration names context get attribute names while names has more elements string name string names next element object value context get attribute name info put name to string value value return info
|
returns a map with all application scope variables
|
public boolean is chinese selected return is food type selected c
|
returns true if the food property includes the marker for
|
public string get descr return descr
|
returns the product description
|
public string get message string msg no valid category selected if quotes equals category quote index if quote index quotes size 1 quote index 0 msg string quotes get quote index else if thoughts equals category thought index if thought index thoughts size 1 thought index 0 msg string thoughts get thought index return msg
|
returns a new message from the selected category every time
|
public string get lucky number return lucky number null lucky number
|
returns the lucky number property value
|
private string null to string string value if value null return null else return value
|
returns the string null if the value is null
|
public string get file name index if index file names size 1 index 0 return string file names get index
|
returns a new file name every time its called cycling through
|
public void set lucky number string lucky number this lucky number lucky number
|
sets the lucky number property value
|
private void init file list file names new array list file names add dilbert2001113293109 gif file names add dilbert2001166171101 gif file names add dilbert2001166171108 gif file names add dilbert2731150011029 gif
|
creates and initializes a data structure to hold the image file
|
public boolean is lucky number valid boolean is valid false if lucky number null string format is valid integer lucky number min lucky number max lucky number is valid true return is valid
|
validates the lucky number property
|
public string get gender return gender null gender
|
returns the gender property value
|
private void set property string prop string value object ds method setter get setter prop ds if setter null system out println data source factory can t find property prop ignored return object args build args value setter try setter invoke ds args catch exception e system out println data source factory can t set property prop value e get message ignored
|
sets the specified property to the specified value in the
|
private method get setter string prop object ds bean info bi null try bi introspector get bean info ds get class catch introspection exception e return null property descriptor pds bi get property descriptors method setter null for int i 0 i pds length i if pds i get name equals prop setter pds i get write method break return setter
|
returns the setter method corresponding to the property name in
|
public void close throws sqlexception is closed true dsw return connection real conn
|
inform the data source wrapper that the connection wrapper
|
public void set digit string value new digit value trim
|
sets the new digit entered by the user
|
private object coerce value string value class type object coerced value null if type is assignable from string class coerced value value else if type is assignable from integer class type is assignable from integer type try coerced value integer value of value catch number format exception e ignore it s reported when trying to set the value else if type is assignable from boolean class type is assignable from boolean type coerced value boolean value of value return coerced value
|
converts the specified string value to the specified type if
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.