input
stringlengths
10
828
output
stringlengths
5
107
public int get number return this value
returns the number on the card
public void read string message throws erroneous message exception try int type integer parse int message substring 0 1 this renew pong if type message factory keepalive return this in type add message substring 1 message length system out println input message end catch number format exception e throw new erroneous message exception message type not supplied catch array index out of bounds exception e throw new erroneous message exception message type invalid
it reads the message
private int get sorting suit if this suit card trump return card trump card trump 2 else if this suit card trump suit this value card trump number return card trump card trump 1 else if this value card trump number return card trump this suit 1 else if this suit card trump suit return card trump else return this suit
it gets the sorted suit
public void renew pong this last pong system current time millis
it updates outgoing timer
public void renew ping this last ping system current time millis
it updates the incoming timer
private int get sorting value return this value card trump number this suit card trump suit card set trump number card set trump this value set trump sorting was taken care of in get sorting suit i think return this value
it gets the sorting value of the card
public void reset for int i 0 i this in length i this in i clear this out clear this renew pong this renew ping
it resets the message factory
public void dispose cleanup this gthread interrupt
it destroys the game room
public void write string message int type this out offer type message this renew ping if type message factory keepalive system out println output message end
it writes the message
public boolean write timeout return system current time millis last ping keepalive
it writes whether the message factory is timed out
private void send update state int state this send command game command update state state this state state
it sends the updated state of the game room
private void send update state int state user user this send command game command update state state user this state state
it sends the updated stated
private void send command string message for iterator user i this users iterator i has next user u i next u get io write this get name message message factory gamecmd this send command message u
it sends the message
private void send command string message user user user get io write this get name message message factory gamecmd
it sends the message to a particular user
public void add selected card button card system out println select card this selected add card
it adds the selected card to the tractor game
private void send command exclude string message user user for iterator user i this users iterator i has next user u i next if u user this send command message u
it sends a message excluding a particular user
public void remove selected card button card system out println deselect card this selected remove card
it removes the selected card from the game
private void set lead user user this lead user int index this users index of user if index 0 1 not found ruh roh 0 number 1 don t do anyone collections rotate this users 0 index
it sets who has lead in the game room
private void send command string message this io write message iofactory gamecmd
it sends a command
private void update stats string stats game command set stats this trump number 4 for iterator user i users iterator i has next user user i next stats user get name user get game score send command stats
it updates the stats of the game room
public boolean condition text object to boolean property dragging boolean property to get property dragging if dragging null if dragging get text object was being dragged at the last frame check drop location if bounds intersects to get bounds return true return false
checks whether or not the mouse is released over the bounds
public action result behave text object to if colorize behave to complete set new target color return new action result false false false
continually assigns a new color to the text object
public action result behave text object to stop all movement vector3 property to get property velocity set new vector3 get the location of the target to get position set target get location return new action result true true false
moves the text object over the target
public void set target locatable target this target target
sets a target to approach
public action result behave text object to boolean property ease switch prop if ease switch prop boolean property to get property ease switch null set up the animation set anim to return new action result false true false if ease switch prop get return get next frame to ease switch prop else there is nothing to do return new action result false true false
computes the position of the text object using robert penners easing equations
public boolean condition text object to if mouse is pressed button to check if to get bounds contains mouse get x mouse get y system out println clicked over to return true return false return mouse is pressed button to check
checks whether or not the mouse is over the given text object
public void register done action string name object o done action new registered action name o
registers the given method with the done action
public void mouse event mouse event event only do something if the first mouse button is clicked if event get button mouse event button1 event get id mouse event mouse clicked return build the text object if the click is over the thumbnail int m x event get x int m y event get y if m x x m x x thumb size m y y m y y thumb size build text object
handles a mouse event
public void draw p fill color 100 p stroke color p stroke weight stroke weight p begin shape for int i 0 i num points 2 i p curve vertex points i x points i y p vertex points num points 2 x points num points 2 y p vertex points num points 1 x points num points 1 y p vertex points 0 x points 0 y p end shape
draws the stat line
public void draw p fill color p no stroke p begin shape for int i 0 i num pts i p curve vertex points i x points i y p vertex points 0 x points 0 y p end shape
draws the stat line
static public void main string args papplet main new string present bgcolor 000000 present stop color 000000 net obxlabs tweetpad sketchpad
runs the applet as an application
private jpanel get button panel if button panel null button panel new jpanel button panel add get start null button panel add get stop null return button panel
this method initializes button panel
private jpanel get jpanel if j panel null j panel new jpanel j panel set layout null time new jlabel time set horizontal alignment javax swing swing constants center time set text 00 00 time set font new java awt font eurostile extended two java awt font bold 24 time set bounds new java awt rectangle 92 46 108 34 time set horizontal text position javax swing swing constants center j panel add time null return j panel
this method initializes j panel
private void initialize this set size 300 200 this set default close operation javax swing jframe exit on close this set content pane get jcontent pane this set title sekundenz hler
this method initializes this
private jpanel get jcontent pane if j content pane null j content pane new jpanel j content pane set layout new border layout j content pane add get button panel java awt border layout south j content pane add get jpanel java awt border layout center return j content pane
this method initializes j content pane
private void load int section string location string destination buffer section append stmt two param ld op location destination
single instructions following
public void do get http servlet request request http servlet response response throws servlet exception ioexception if request get parameter open null response set header pragma public response set header cache control must revalidate post check 0 pre check 0 response set header expires 0 response set header content disposition attachment filename preview na gif try if true equals request get parameter download text response get writer write document text else request dispatcher rd request get request dispatcher skin images preview na gif rd forward request response catch exception e e print stack trace
the do get method of the servlet
private menu setup context menu menu context menu new menu menu item delete item new menu item delete item set title i18 n message ddelete delete item add click handler new com smartgwt client widgets menu events click handler public void on click menu item click event event list grid record selection list get selection if selection null selection length 0 return ld ask i18 n message question i18 n message confirmdelete new boolean callback override public void execute boolean value if value list remove selected data context menu set items delete item return context menu
prepares the context menu
public void update record guigroup group list grid record record list get selected record if record null record new list grid record record set attribute description group get description record set attribute name group get name if record get attribute as string id null group get id long parse long record get attribute as string id list update data record else append a new record record set attribute id group get id list add data record list select record record
updates the selected record with new data
public void add word guitag word boolean exist false for guitag t tags if t get tag equals ignore case word get tag t set count t get count 1 exist true if exist tags add word refresh
add a word to the tagcloud list
public void refresh string tcloud tags for guitag w tags tcloud a href url encode w get link style w get scale 4 color 0x000000 hicolor 0x314976 w get tag a tcloud tags tcloud tcolor 0x111111 tcolor2 0x336699 hicolor 0x tspeed 100 distr true mode both tagcloud tcloud if container null remove member container container new vlayout container set width 95 container set height get height 20 add member container html new htmlflow util flash html tagcloud swf get width 40 get height 40 tcloud container add member html
refresh the display of the tag cloud
public void trigger upload document service async document service document service async gwt create document service class document service add documents session get get sid i18 n get locale session get get current folder get id utf 8 false null new async callback void override public void on failure throwable caught log server error caught override public void on success void result documents panel get refresh
triggers the load of the last uploaded files
public void after save
invoked after the data was saved on the server
public void on selected task guitask task if detail panel instanceof task detail panel details remove member detail panel detail panel destroy detail panel new task detail panel this details add member detail panel task detail panel detail panel set task task
shows the task details
public void update selected record guitask task list get selected record set attribute scheduling task get scheduling label list update data list get selected record
updates the selected record with the new task data
protected void prepare menu documents menu new documents menu documents menu set show resize bar true
prepare the collapsible menu
public void on folder select long folder id long doc id if doc id null hilite doc id doc id folder service get folder session get get sid folder id false new async callback guifolder override public void on failure throwable caught log server error caught override public void on success guifolder folder update listing panel folder hilite doc id max
shows the documents list under the folder with the given folder id and
public void show folder details if hilite doc id null on selected document hilite doc id false else detail panel destroy detail panel new folder details panel folder navigator get details add member detail panel details redraw
shows folders data in the details area
public void select folder long folder id service get folder session get get sid folder id false new async callback guifolder override public void on failure throwable caught sc say caught to string log server error caught override public void on success guifolder result if result null if result get id constants documents folderid result set path extended else result set path extended get path result get id session get set current folder result
select the specified folder
private void reload media string media provider string f file name to lower case if f ends with mp3 f ends with wav f ends with wma media provider sound else media provider video media new htmlflow string url gwt get host page base url download sid session get get sid 26doc id id 26filename file name string tmp util flash preview audio video player swf url media provider get width 26 get height 40 media set contents tmp layout add member media
reloads a media preview
private void reload cad boolean print enabled cad new htmlflow string url gwt get host page base url download sid session get get sid doc id id string tmp applet name cad applet archive util context path applet dxf applet jar code de caff dxf applet dxf applet width get width 26 height get height 40 tmp param name dxf file value url tmp param name dxf applet gui descr value util context path applet print enabled print xml default xml tmp param name locale value i18 n get locale tmp applet cad set contents tmp layout add member cad
reloads a cad preview
private void reload image boolean print enabled string language image new htmlflow string url gwt get host page base url thumbnail sid session get get sid 26doc id id 26suffix preview swf string flash flexpaperviewer swf if print enabled flash flexpaperviewer ro swf string tmp util flash preview flash get width 26 get height 40 get zoom swf file url print enabled get preview language language image set contents tmp layout add member image
reloads an image preview
private void retrieve user info guifolder folder session get get current folder print enabled folder null folder is download guiuser user session get get user language user get language
retrieve the user information regarding the download permission and the
protected menu add useful menu item final list grid record record menu context menu do nothing return context menu
this method is used only by the classes that extend this class
private void on add bookmark final tree node selected node tree node get selected record final long folder id long parse long selected node get attribute as string folder id doc service add bookmarks session get get sid new long folder id 1 new async callback void override public void on failure throwable caught log server error caught override public void on success void v
adds a bookmark to the currently selected folder
public void update record guishare share list grid record record list get selected record if record null record new list grid record record set attribute src share get path record set attribute eenabled share get enabled 1 0 2 record set attribute type smb equals share get provider i18 n message remote i18 n message local if record get attribute as string id null share get id long parse long record get attribute as string id list update data record else append a new record record set attribute id share get id list add data record list select record record
updates the selected record with new data
public void update record guiemail account share list grid record record list get selected record if record null record new list grid record record set attribute email share get mail address record set attribute eenabled share get enabled 1 0 2 if record get attribute as string id null share get id long parse long record get attribute as string id list update data record else append a new record record set attribute id share get id list add data record list select record record
updates the selected record with new data
public void update record guitemplate template list grid record record list get selected record if record null record new list grid record record set attribute name template get name record set attribute description template get description if record get attribute as string id null template get id long parse long record get attribute as string id list update data record else append a new record record set attribute id template get id record set attribute readonly template is readonly record set attribute documents 0 list add data record list select record record
updates the selected record with new data
private void save templates record records grid get records if records null records length 0 return guivalue pair templates new guivalue pair records length int i 0 for record record records templates i new guivalue pair templates i set code record get attribute as string name templates i set value record get attribute as string folders service save templates session get get sid templates new async callback void override public void on failure throwable caught log server error caught override public void on success void arg0 log info i18 n message settingssaved null
sends the patterns in the grid to the server to save them
private void save patterns record records patterns grid get records string patterns new string records length int i 0 for record record records patterns i record get attribute as string pattern service save patterns session get get sid patterns get selected template new async callback void override public void on failure throwable caught log server error caught override public void on success void arg0 log info i18 n message settingssaved null
sends the patterns in the grid to the server to save them
private void restore straight connection get movable points clear connection set straight diagram controller run refresh
restore the connection to a straight segment
private tab setup language final values manager vm tab language tab new tab language tab set title i18 n message language select item language item item factory new language selector language false true language item set title i18 n message defaultlang language item set required true language item set value i18 n get locale final dynamic form language form new dynamic form language form set id language form language form set values manager vm language form set fields language item language form set disabled true language tab set pane language form return language tab
prepares the language form
public void do get http servlet request request http servlet response response throws servlet exception ioexception try request dispatcher rd request get request dispatcher frontend sc skins logical doc images preview na gif rd forward request response catch exception e e print stack trace
the do get method of the servlet
public date get creation return creation
the archives creation date
public object get value switch type case type string return get string value case type int return get int value case type double return get double value case type date return get date value return null
gets the attribute value
public long get creator id return creator id
the archive creator id
public string get creator name return creator name
the archive creator name
public long get closer id return closer id
the archive closer id
public string get closer name return closer name
the archive closer name
public date get closure return closure
the archives closure date
public void set password string pwd if org apache commons lang string utils is not empty pwd password crypt util crypt string pwd
sets the password and encode it
public void clear diagram connections clear widget shape map clear functions map clear shapes clear start function widget null build connection null restart widget pane if scroll panel null scroll panel clear widget panel clear widget panel add top canvas as widget top canvas get element get style set position position absolute show grid show grid
clear the diagram connections and widgets
public object get value switch type case type string return get string value case type int return get int value case type double return get double value case type date return abstract service convert string to date get date value return null
gets the attribute value
public connection draw straight arrow connection widget start widget widget end widget string name connection c draw connection connection factory arrow start widget end widget functions map get start widget put end widget c state widget widget new state widget c this name null name i18 n message transitionname add decoration widget c return c
draw a straight connection with an arrow between two gwt widgets
public connection draw straight connection widget start widget widget end widget connection c draw connection connection factory straight start widget end widget functions map get start widget put end widget c return c
draw a straight connection between two gwt widgets
public string get user group name return user get id
the name of the group associated to this user that is user id
public string get password changed return password changed
when the password was modified
public int get password expires return password expires
if the password expires or not
public void add decoration widget decoration connection decorated connection decoration get element get style set zindex 10 decoration get element get style set position position absolute widget panel add decoration decorated connection set decoration new decoration shape this decoration decorated connection set synchronized false
add a widget as a decoration on a connection
public int get source return source
the source from which the user has been created
public void remove decoration connection decorated connection decoration shape deco shape decorated connection get decoration if deco shape null widget panel remove deco shape as widget decorated connection remove decoration
remove a decoration from the diagram
public void add point on connection connection c int left int top c add movable point new point left top
add an segment on a path by adding a point on the connection
public void show grid boolean show grid this show grid show grid background canvas init grid if this show grid widget panel add background canvas as widget else widget panel remove background canvas as widget
change the background of the canvas by displaying or not a gray grid
public diagram canvas get diagram canvas return top canvas
get the diagram canvas
public void register drag controller drag controller drag controller this drag controller drag controller for function shape shape shapes register drag handler shape
register a drag controller to control the refresh rate
protected void check group string sid string group throws exception user user validate session sid if user is in group group string message user user get user name doesn t belong to group group log error message throw new exception message
checks if the current user belongs to a group
protected void check administrator string sid throws exception check group sid admin
checks if the current user is an administrator group admin
protected void redraw connections connections get unsynchronized drawables draw
if any connections need to be redrawn clear the canvas and redraw all
protected void copy resource string classpath file out throws ioexception input stream is new buffered input stream this get class get resource classpath open stream output stream os new buffered output stream new file output stream out try for int b is read if b 1 break os write b finally is close os close
copy a resource from the classpath into a file
private void destroy database connection con null try con ds get connection con create statement execute shutdown catch exception e try if con null con close catch exception ex
destroys the in memory database
private void create test database throws exception ds data source context get bean data source connection con null try con ds get connection load schema sql file sql file new sql file core schema file cp1252 false sql file set connection con sql file execute load data sql file new sql file data file cp1252 false sql file set connection con sql file execute test the connection result set rs con create statement execute query select from ld menu where ld id 2 rs next assert assert equals 2 rs get int 1 finally if con null con close
creates an in memory test database
public void set value object value if value instanceof string this type type string set string value string value else if value instanceof integer this type type int set int value new long integer value else if value instanceof long this type type int set int value long value else if value instanceof double this type type double set double value double value else if value instanceof date this type type date set date value date value else throw new illegal argument exception no a string long double or date value
sets the attribute value
public int get mandatory return mandatory
whether an attribute value is mandatory or not
public boolean get string lock name string transaction id gregorian calendar cal new gregorian calendar cal add calendar second config get int lock wait date ld date cal get time while new date before ld date if get internal lock name transaction id log debug acquired lock lock name return true else try thread sleep 1000 catch interrupted exception e log warn unable to get lock lock name return false
acquire a lock of a given name and for a given transaction
public void release string lock name string transaction id if lock name null transaction id null return generic lock generic dao find by alternate key lock lock name if lock null transaction id equals lock get string1 lock set date1 null lock set string1 null generic dao store lock
releases a previously acquired lock
private void save statistic string parameter object val generic gen generic dao find by alternate key stat parameter if gen null gen new generic gen set type stat gen set subtype parameter else generic dao initialize gen if val instanceof string gen set string1 string val else if val instanceof long gen set integer1 long val int value else gen set integer1 integer val generic dao store gen
convenience method for saving statistical data in the db as generics
protected hibernate template get hibernate template integer max results if max results null max results 1 return get hibernate template hibernate template template new hibernate template get session factory template set max results max results return template
useful method that creates a template for returnig a maximum number of
public language get language locale locale return languages get locale
retrieves the language for the given language null is returned if the
public void set dictionary map string object dictionary this dictionary dictionary
map that collects session bound values
public object get external session return external session
representation of the container session eventually associated to this