input
stringlengths
10
828
output
stringlengths
5
107
public string get table jid return string fields get table
the jid of the game table to be joined
public string get referee jid return string fields get referee
the jid of the referee of the game table
public string get game name return string fields get name
the games name
public string get parlor jid return string fields get parlor
the jid of the game parlor that created the game table or null
public string get message return string fields get message
the text message accompanying the invitation or null if it was
protected void add string key string value string language list ls if m map contains key key ls new array list m map put key ls else ls list m map get key ls add new entry value language
add an entry to a metadata set
public string get string key string language list ls list m map get key if ls null return null string result none null string result wrong null for int ix 0 ix ls size ix entry val entry ls get ix string lang val get language if language null lang null lang equals language return val get value if lang null if result none null result none val get value else if result wrong null result wrong val get value if result none null return result none else return result wrong
retrieve an entry from the set
public list get all string key list res new array list list ls list m map get key if ls null for int ix 0 ix ls size ix entry val entry ls get ix string value val get value res add value return res
retrieve all the entries from the set which match the given key
public void start m responder start
start listening for invitations
public void stop m responder stop
stop listening for invitations
public interface verify game callback public void reply boolean val
interface for reply to verify game
public void add listener listener listener assert m listener null m listener listener
add an rpc listener
public void remove listener listener listener assert m listener listener m listener null
remove the listener
public list get all entries string key list res new array list list ls list m map get key if ls null for int ix 0 ix ls size ix entry val entry ls get ix res add val return res
retrieve all the entries from the set which match the given key
protected user agent create user agent user agent agent new user agent javolin return agent
override the creation of a user agent
public url get resource location uri uri if uri null uri to string equals uri s blank uri resource entry entry resource entry m resources get uri if entry null return null return entry source
get the external location of the file containing the resource with the
public void stop audio stop group this responder stop expunge our references to everything so that garbage collection works dispatcher clear dispatcher volity stop dispatcher volity null filter stop filter null seat objects clear if scope null scope delete game scope delete volity scope delete info scope delete metadata scope delete rpc scope delete literalmessage scope delete localize scope delete message scope delete seatmark scope delete audio scope null game null volity null info null
disconnect the rpc handler and cease work
public game info get game info if m game info null return m game info string parlor jid get responder jid service discovery manager disco man service discovery manager get instance for get connection try this really ought to be async although since it s cached it s not a serious problem discover info info disco man discover info parlor jid m game info new game info parlor jid info catch xmppexception ex can t disco i guess all the info fields are null m game info new game info parlor jid return m game info
returns the block of information which is found in the parlors disco
public uri get ruleset return get game info get ruleset uri
ask what ruleset the game server implements
public url get local resource location uri uri if uri null uri to string equals uri s blank uri resource entry entry resource entry m resources get uri if entry null return null return entry file
get the location of the file containing the resource with the given uri
public void join string nickname throws xmppexception if m alive m muc null throw new xmppexception game table cannot rejoin once it shuts down m muc join nickname
join the muc
public metadata get resource uri uri if uri null uri to string equals uri s blank uri resource entry entry resource entry m resources get uri if entry null return null if entry metadata null try entry metadata parse svgmetadata entry file this catch exception ex nothing we can do return entry metadata
get the metadata associated with the given resource uri
public list get all resources list res new array list for iterator it m resources key set iterator it has next uri key uri it next if key to string equals don t repeat the resource that is the top level file continue res add key return res
return a list of the resource uris in the metadata list
static public class available bot public string jid public string uri public string name public available bot string jid string uri string name this jid jid this uri uri this name name
data class for the list of available bots
protected void set nick string nick m nick nick
record a change in the muc nickname of the player
public boolean is self return m is self
does this player represent the client
public boolean is referee return m is referee
does this player represent the referee
public boolean is bot return m is bot
is this a bot
protected void set referee boolean val m is referee val
record whether the player is the referee
public boolean is ready return m is ready
is this player marked ready
protected void set ready boolean flag m is ready flag
set the ready flag
public boolean is seated return m seat null
is this player seated
public seat get seat return m seat
return the players seat or null if unseated
protected void set seat seat seat m seat seat
set the players seat null means unseated
protected void stop synchronized m thread lock try if m socket null m socket close catch ioexception ex ignore error wait until the thread exits try while m socket null m thread lock wait catch interrupted exception ex never mind
kill the watcher thread
public void run while m socket null m socket is closed try socket socket m socket accept inet address addr socket get inet address only allow connections from ourself if addr is loopback address new command handler socket catch ioexception ex give up on socket break synchronized m thread lock close the socket before the thread exits try if m socket null m socket close catch ioexception ex ignore error m socket null m thread lock notify all
implements runnable interface for the socket thread
protected void execute string val assert swing utilities is event dispatch thread not in ui thread javolin app get sole javolin app do open url val
do the work of executing a url that has been received
public void set table game table table this table table if ui null ui set table table
set the table where this game is being played
public void handle throwable ex m error ex m date new date if ex instanceof out of memory error this is fatal system out println detected fatal exception ex to string system exit 1 system out println detected exception ex to string ex print stack trace uncomment for serious debugging synchronized last error lock last error this audio play error
place the given throwable into an error wrapper
protected jtext pane build text pane return new jtext pane public void scroll rect to visible rectangle rect do nothing
create a jtext pane
public url get result return m result
retrieve the url entered by the user
public static gurlhandler get instance if sole instance null system load library mac gurl sole instance new gurlhandler return sole instance
fetch the singleton gurlhandler object
private void callback string url synchronized lock if listeners size 0 cached urls add url else for int ix 0 ix listeners size ix gurllistener listener gurllistener listeners get ix listener handle url
called by the native code
protected void finalize throws throwable if registered remove event handler registered false
deregister the get url apple event handler
private void try set document string urlstr if m display null return try set current url urlstr null m display set document urlstr catch xrruntime exception ex new error wrapper ex string errortext fallback error text errortext errortext replace all finder finder url errortext errortext replace all bugreport bugreport url try byte bytes errortext get bytes utf 8 input stream instr new byte array input stream bytes m display set document instr finder url catch exception ex2 give up
attempt to go to the given url
protected void set current url string urlstr url url if url null try url new url urlstr catch malformed urlexception ex never mind synchronized m thread lock m current urlstr m current url url
set the url we are looking at
protected void reset timer synchronized m thread lock m last doc check system current time millis
kick the timer we keep for how recently weve checked the document
public referee get referee return m referee
the referee for this table or null if no referee is connected
public string get referee jid if m referee null return null return m referee get responder jid
return the jid of the tables referee
public uri get result return m result
retrieve the uri entered by the user
public void dispose if m popup menu null m popup menu dispose m popup menu null jtext pane popup m text pane dispose m color map remove listener m color change listener don t dispose of the colormap we don t own it super dispose
clean up component
protected jtext pane build text pane return new jtext pane popup this
create a jtext pane subclass
public void message string text message null false null text null
display a message which is not associated with any user
public void message string jid string nick string text message jid true nick text null
display a message
public void message string jid string nick string text date date message jid true nick text date
display a message
protected entry get entry string jid boolean real entry ent entry m user map get jid if ent null ent new entry jid real m user map put jid ent return ent
get the entry for a given jid creating one if necessary
protected void adjust all colors for iterator it m user map values iterator it has next entry ent entry it next ent adjust colors element el m document get default root element recurse elements el
recolor all the text
public void remove shutdown listener ready listener listener synchronized shutdown listeners shutdown listeners remove listener
remove a table joined listener
protected void display popup menu int xp int yp if m popup menu null return int pos m text pane view to model new point xp yp element el m document get character element pos if el null return attribute set attrs el get attributes if attrs null return string jid string attrs get attribute attr jid if jid null return boolean realjid boolean attrs get attribute attr realjid if realjid null realjid boolean value return m popup menu adjust show jid m text pane xp yp
given a popup inducing click at a particular location see if theres a
protected void adjust colors if m color map null return color name color m color map get user name color m jid color text color m color map get user text color m jid style constants set foreground style name name color style constants set foreground style text text color
re fetch the colors from the colormap and modify the name and
public void dispose m owner null
clean up component
protected void process mouse event mouse event ev if ev is popup trigger if m owner null m owner display popup menu ev get x ev get y return if ev get id mouse event mouse clicked ev get click count 1 platform wrapper launch urlavailable m owner null if m owner launch urlat ev get x ev get y return super process mouse event ev
customized mouse handler that knows about popup clicks
public void scroll rect to visible rectangle rect do nothing
block the scroll rect to visible method as required by
public void dispose remove all m jid null
clean up component
protected void build ui m chat menu item new jmenu item localize chat m chat menu item add action listener this add m chat menu item m roster add menu item new jmenu item localize roster add m roster add menu item add action listener this add m roster add menu item m invites menu new jmenu localize invite menu add m invites menu m stats menu item new jmenu item localize stats m stats menu item add action listener this add m stats menu item if platform wrapper launch urlavailable m stats menu item set enabled false
create the interface
static public void set last known resource string jid string barejid string utils parse bare address jid s resource tracker put barejid jid
put this full jid into the mapping
static public void clear last known resource string jid string barejid string utils parse bare address jid if jid equals barejid string fulljid string s resource tracker get barejid if fulljid null return if fulljid equals jid return s resource tracker remove barejid
remove this jid from the mapping
private void clear cached colors for iterator it m hue map values iterator it has next color entry ent color entry it next ent m title color null ent m body color null
clear the computed colors stored in the map
public void add listener change listener listener synchronized m listeners m listeners add listener
add a map changed listener
public void remove listener change listener listener synchronized m listeners m listeners remove listener
remove a map changed listener
private void fire listeners change event ev new change event this for iterator iter m listeners iterator iter has next change listener iter next state changed ev
notify listeners that the colors in the map have changed
private void check owner disco discover info info player player if player get player by jid player get jid this player object is obsolete forget it return form form form get form from info if form null form field field form get field volity role if field null string role string field get values next if role equals referee m referee null player set referee true found referee player
this is a disco background callback so its running in the swing thread
public void set participant string jid participant jid
set a new jid for this chat
public player get player by jid string jid for iterator it m players iterator it has next player player player it next if player get jid equals jid return player return null
get the player with a given real jid
public void save state preferences prefs preferences user node for package m window get class node m node name for int ix 0 ix m table get column count ix table column col m table get column model get column ix string colname string col get identifier prefs put int colwidth key colname col get width string colpref for int ix 0 ix m table get column count ix table column col m table get column model get column ix string colname string col get identifier colpref colname prefs put colorder key colpref
write out the column order and widths
public iterator get unseated players return new iterator filter m players public boolean matches object obj player player player obj return player get seat null
return an iterator of all the players who are not seated
public void dispose if m popup menu null m popup menu dispose m popup menu null
clean up component
private void setup listeners link listener link listener new vol link listener this add mouse listener link listener add mouse motion listener link listener
add mouse event handlers for cursor changing and hyperlinks
public int link disposition url url string urlstr return handle external
given a url decide how to handle it
private void try set document string urlstr if m display null return try set current url urlstr null m display set document urlstr catch xrruntime exception ex new error wrapper ex string errortext fallback error text errortext errortext replace all helpwin helpwin url errortext errortext replace all bugreport bugreport url try byte bytes errortext get bytes utf 8 input stream instr new byte array input stream bytes m display set document instr helpwin url catch exception ex2 give up
attempt to go to the given url
protected void display popup menu string jid int xp int yp if m popup menu null point pt get location on screen m popup menu adjust show jid this xp pt x yp pt y
pop up a contextual menu for the given jid
protected void set current url string urlstr url url if url null try url new url urlstr catch malformed urlexception ex never mind m current urlstr m current url url
set the url we are looking at
public void add status listener status listener listener status listeners add listener
add a player readiness change listener
public boolean is jidpresent string jid object ls get components for int ix 0 ix ls length ix if ls ix instanceof jlabel pop jlabel pop label jlabel pop ls ix if label m jid equals jid return true return false
check whether this jid is in the current list
public void select callback callback m callback callback preferences prefs preferences user node for package get class node nodenamelast string urlstr prefs get m ruleset to string null if urlstr null try m last choice new url urlstr catch malformed urlexception ex don t know why this would happen new error wrapper ex queue up the first function swing utilities invoke later new runnable public void run cont from top
begin the work of selection
public void select callback callback m callback callback game resource prefs gameprefs javolin app get sole javolin app get game resource prefs m last choice gameprefs get url m res uri queue up the first function swing utilities invoke later new runnable public void run cont from top
begin the work of selection
public void remove status listener status listener listener status listeners remove listener
remove a player readiness change listener
private void save window state m table saver save state
store the window state preferences
private void restore window state m table saver restore state
load the window state preferences
public void set referee state int newstate if newstate m referee state int oldstate m referee state m referee state newstate if newstate state setup for iterator it m seats iterator it has next seat seat seat it next seat set active false if oldstate state setup for iterator it m seats iterator it has next seat seat seat it next seat set active seat is occupied seat is required fire status listeners state changed m referee state
react to a change in referee state
private void do select make sure exactly one row is selected int rows m table get selected rows if rows length 1 return object urlo m model get value at rows 0 1 if urlo null default urlstr equals urlo urlo null else if urlo null urlo instanceof url return m success true m result url urlo dispose
the select action
public void set referee state string val int newstate state unknown if val equals setup newstate state setup else if val equals suspended newstate state suspended else if val equals active newstate state active else if val equals disrupted newstate state disrupted else if val equals abandoned newstate state abandoned else if val equals authorizing newstate state authorizing set referee state newstate
react to a change in referee state expressed as a string
public int get referee state return m referee state
get the current known referee state
public boolean is referee state active if m referee state state active m referee state state disrupted m referee state state abandoned return true else return false
test whether the current known referee state corresponds to a form of
public void dispose if m show help listener null prefs dialog remove listener prefs dialog game options m show help listener m show help listener null if m table null m table remove status listener this m table null
clean up this component
public void set in state recovery boolean val m in state recovery val
set whether the table is currently sending us a state recovery burst
public boolean get in state recovery return m in state recovery
check whether the table is currently sending us a state recovery burst
public void set url uri uri url url preferences prefs preferences user node for package get class node nodename if url null prefs put uri to string url to string else prefs remove uri to string
set the resource url for the given resource uri
public url get url uri uri preferences prefs preferences user node for package get class node nodename string urlstr prefs get uri to string null if urlstr null return null try url url new url urlstr return url catch exception ex return null
get the resource url for the given resource uri
public file get resource uri uri preferences prefs preferences user node for package get class node nodename string urlstr prefs get uri to string null if urlstr null return null try url url new url urlstr file ui dir m cache get uidir url ui dir uifile cache locate top directory ui dir if there s exactly one file that s it otherwise look for main svg or main svg file ui main file uifile cache locate main file ui dir return ui main file catch exception ex new error wrapper ex return null
get the main file of the preferred resource for the given resource uri