input
stringlengths
10
828
output
stringlengths
5
107
public void clean throws sqlexception stmt get connection close log close connection
close the connection
public pentry get person string code throws sqlexception return new pentry impl
retrieve a person
public zkentry get zeitkarte string key string code throws sqlexception return new zkentry impl
retrieve a zeitkarte
public void close zkentry zke linked list to remove throws sqlexception
close the items of the list
public void stamp person pentry pe throws sqlexception change the stat
change the persons state in db checked in out
public void open new zkentry zke linked list to open throws sqlexception
open the new items of the list
public protocol create protocol string protocol version protocol result null if protocol version equals 3 result create protocol3 return result if protocol version equals 4 result create protocol4 return result if protocol version equals 5 result create protocol5 return result if protocol version equals 6 result create protocol6 return result if protocol version equals default result create protocol default return result return result
returns the protocol specified by protocol version
public int count armies player p int counter 0 enumeration e country c e countries elements while e has more elements c country e next element if c get owner p counter c get armies return counter
counts all the armies of the player
public int count countries player p int counter 0 enumeration e country c e countries elements while e has more elements c country e next element if c get owner p counter return counter
counts all the countries owned by the player
public string read throws ioexception return in read line
reads a message from the client
public void write string message try out write message out new line out flush log debug write to player get name message message catch ioexception exc controller remove connection this
sends a message to the client
public world get world return get game controller get world
do only use after set game controller
public void send message string message enumeration e player p e players elements while e has more elements p player e next element p send message message
sends the same message to all the players
private void roll dices for int i 0 i 6 i if i 3 source dices i r next int 6 1 if i 3 dest dices i 3 r next int 6 1 sort source dices sort dest dices
rolls the dices and returns 6 numbes between 1 and 6
public void send message answer a enumeration e player p e players elements while e has more elements p player e next element p send message a get answer p get protocol
sends the same answer to all the players
public string get string key return string attributes get key
if there is no attribute with key null is returned
public boolean has single owner player owner country c owner country countries element at 0 get owner for int i 1 i countries size i c country countries element at i if c get owner owner return false return true
returns true is all countries of this continent are owned by 1 player
public void add message handler string message id message handler mh log debug added mh for message id message id mhs put message id mh
adds a message handler to this protocol
public player get owner player p null if has single owner country c country countries element at 0 p c get owner return p
returns the players who owns all the countries of this continent else null
protected void init world w mission controller mc game controller gc world w mission control mc game control gc
initializes this message handler
public int count countries player p int r 0 for int i 0 i countries size i country c country countries element at i if c get owner p r return r
counts the countries of this continent owned by p
public void create new connection socket client socket throws ioexception client connection c c new client connection client socket this connections add c log info created new client connection successfull
serverconnection calls this method if it receives a client connect
public void remove connection client connection connection
called by client connection if there are io problems
public void remove server connection
called by server connection if there are io problems
public void send message string message connection write message log debug send to player name message
sends a message to this player
public void send message answer a send message a get answer protocol version
sends the answer to the player
public void add score int s score s
adds s to the score
public boolean has more information return index counter
returns true if there is more player information in this message
public void reset information index 0
resets the information pointer so you could start back at the beginning
public void next information index
if you want to access the next information object
public player get player int player id throws exception if debug system out println player list searching for player with id player id player p enumeration elements players elements while elements has more elements p player elements next element if p get id player id return p throw new exception there exists no player with id player id
returns player object
public void add card controller listener card controller listener ccl if debug system out println card controller listener added to card controller listeners add ccl
adds a listener interested in the status of the card controller
public void notify all listeners card controller listener l enumeration e listeners elements while e has more elements l card controller listener e next element l cards changed this
notifies all listeners that the card controller has changed
public string get message name return exit
method from message interface
public int get exiting player return player number
returns the information in this message namely the player id
public void message arrived message m if m get message name equals mission if debug system out println received a mission message mission message mm mission message m mission type mm get mission type mission number mm get mission number if mission number 0 mission type 1 parent set visible true
required to implement the message listener interface
public int get current value return dice get current value
returns the value of the dice associated with this dicecanvas
public int get location y return y coord
returns the y coordinate of the absolute location of this dice
public boolean is active return dice is active
returns whether the dice is currently activated
public void set value int new value dice set value new value
set the value of the dice to this value
public void activate dice activate
activates the dice
public string get country name return country get country name
returns the name of the country associated with this country canvas
public int get absolute ycoord return position y
returns the y coordinate of the absolute location of this country
public void set owner player owner country set owner owner
sets the new owner of the country associated with this country canvas
public void close dialog window event event set visible false
method to close the dialog
public int get current value return value
returns the value of the dice
public void add board model listener board model listener bml if debug system out println board model listener added to board controller listeners add bml
adds a listener interested in the board model this listener
public void notify all listeners board model listener l enumeration e listeners elements while e has more elements l board model listener e next element l board changed board model
notifies all listeners that the board model has changed
public void message arrived message m if debug system out println board controller received message board model message arrived m notify all listeners
method from the message listener interface
public void de activate card int country id vector active cards get active cards card current card for int index 0 index active cards size index current card card active cards element at index if current card get country get id country id if debug system out println card with countrycode country id current card get country get country name will be de activated now current card de activate if debug system out println card with countrycode country id current card get country get country name is de activated
de activate the card with the specified country id
public string get continent name return continent name
returns the name of the continent this country is in
public int get id return country number
returns the number of the country
public int get number of armies return nr of armies
returns the number of armies currently present in this country
public int get card type return card type
the type of the card connected to this country
public int get type return type id
returns the type of this card
public void set owner player owner owner owner
sets a specific player as the owner of the country
public image get image return image images element at get type
returns the imageobject that represents this country
public void add armies int armies nr of armies armies
add a specified number of armies to this country
public void set number of armies int armies nr of armies armies
sets the number of armies on the country to a given number
public void change selected selected selected
changes the current select state of the country
public void select if debug system out println select get country name selected true
selects this country
public void unselect if debug system out println unselect get country name selected false
unselects this country
public void send string message string error message throws server exception try if debug system out println tegserver send to server message current connection write to server message catch ioexception exc throw new server exception error message
sends a message to the tegserver
public string get message from server throws ioexception server exception if current connection null throw new server exception language manager get instance lookup currentlynotconnected if debug system out println request received to send message to connection return current connection read from server
gets a message from the tegserver in stringformat
private void unselect all countries country c enumeration e countries elements while e has more elements c country e next element c unselect
unselects all countries
public void select if debug system out println selected card with country get country get country name selected true
selects this card
public void unselect if debug system out println unselected card with country get country get country name selected false
unselects this card
public color get color switch color case 0 return color red case 1 return color yellow case 2 return color blue case 3 return color black case 4 return color pink case 5 return color green default should never happen return color gray
returns the java
public double price per month double r double price double length return r
calculate the monthly subscription price in euro
public boolean handle event event event if event id event window destroy system exit 0 return super handle event event
catch window destroy events
public void write node node write node
output a dom node such as a document to the output stream
private double norm double x1 double y1 double x2 double y2 double x diff x2 x1 double y diff y2 y1 return math sqrt x diff x diff y diff y diff end norm
calculate distance between two points
public string get google order no return root get attribute google order number
return the google order number which is the value of the
public string get google order no return utils get element string value document root google order number
return the google order number which is the value of the
public string get tracking no element tracking data tag utils find container else create document root tracking data return utils get element string value document tracking data tag tracking number
return the tracking number which is the value of the
public boolean is send email return utils get element boolean value document root send email
true if an email is to be sent to the buyer
public void set google order no string google order no root set attribute google order number google order no
set the google order number which is the value of the
public void set tracking no string tracking no element tracking data tag utils find container else create document root tracking data utils find element and set else create and set document tracking data tag tracking number tracking no
set the tracking number which is the value of the
public void set send email boolean send email utils find element and set else create and set document root send email send email
true if an email is to be sent to the buyer
public boolean is within cancel string limits string reason string comment int len str reason reason length int len str comment comment length if len str reason constants cancel str limit len str comment constants cancel str limit return true else return false
determine whether the reason and comment are within the string length
public string get comment return utils get element string value document root comment
return the cancel order comment string which is the value of the
public string get merchant order no return utils get element string value document root merchant order number
return the merchant order number which is the value of the
public void set merchant order no string merchant order no utils find element and set else create and set document root merchant order number merchant order no
set the merchant order number which is the value of the
public string get reason return utils get element string value document root reason
return the cancel order reason string which is the value of the
public void set comment string comment if is within cancel string limits comment comment system err println constants cancel error string utils find element and set else create and set document root comment comment
set the cancel order comment string which is the value of the
public boolean is within message string limits string message int len str message message length if len str message constants message str limit return true else return false
determine whether the message is within the string length limits
public void set reason string reason if is within cancel string limits reason reason system err println constants cancel error string utils find element and set else create and set document root reason reason
set the cancel order reason string which is the value of the
public string get message return utils get element string value document root message
return the message which is to be sent to the buyer
public void set message string message if is within message string limits message message system err println constants message error string utils find element and set else create and set document root message message
set the message which is to be sent to the customer
public boolean is within refund string limits string reason string comment int len str reason reason length int len str comment comment length if len str reason constants refund str limit len str comment constants refund str limit return true else return false
determine whether the reason and comment are within the string length
public boolean is valid request string node name root get node name if checkout redirect equals node name request received equals node name return true return false
gets a value indicating whether google returned an error code or not
public string get item description return utils get element string value document element item description
retrive the contents of the lt item description gt tag
public string get serial number return root get attribute serial number
gets the serial number
public string get item name return utils get element string value document element item name
retrive the contents of the lt item name gt tag
public string get error message return utils get element string value document root error message
if google responded with an error is good false then this property
public string get merchant item id return utils get element string value document element merchant item id
retrive the contents of the lt merchant item id gt tag
public int get quantity return utils get element int value document element quantity
retrive the contents of the lt quantity gt tag
public string get redirect url return utils get element string value document root redirect url
if google indicated a redirect url in the response this property will
public float get amount return utils get element float value document root amount
return the refund amount which is value of the lt amount gt tag
public string get tax table selector return utils get element string value document element tax table selector
retrive the contents of the lt tax table selector gt tag