input
stringlengths
10
828
output
stringlengths
5
107
public card list get main deck return main deck
this method returns a reference to the main deck
public card list get sideboard return sideboard
this method returns a reference to the sideboard
public hashtable get deck props return deck props
this method is used to retrieve the properties of the deck itself
public void set file name string file path set list null super set file name file path
this method is used to set the file to be parsed
public string get set version return set version
this method returns the version of the file being parsed
private void init text panel text tf new javax swing jtext area text tf set wrap style word true text tf set editable false text tf set font new java awt font dialog 0 12 text tf set text card text text tf set line wrap true text scroll new javax swing jscroll pane text tf txt panel add text scroll java awt border layout center
this method sets up the panel to display the card text
private void init set panel set tf new javax swing jtext area set tf set wrap style word true set tf set editable false set tf set font new java awt font dialog 0 12 set tf set text sets set tf set line wrap true set scroll new javax swing jscroll pane set tf set panel add set scroll java awt border layout center
this method sets up the panel to display the card sets
public void drag over final java awt dnd drag source drag event p1 system err println dsl drag over
this method implements drag source listener
public void drag enter final java awt dnd drag source drag event p1 system err println dsl drag enter
this method implements drag source listener
private void list table mouse pressed java awt event mouse event evt if evt get click count 2 dialog is enabled card detail dialog show card get selected card get name
this method is called when the user clicks on the table
private void exit form java awt event window event evt dispose my parent dispose
this method disposes of the window and its parent when it is closed
public boolean get answer return answer
this method gets the users answer to the yes no question
protected string get title return info dialog
this method returns the string title to put on the dialog
public card get selected card return cards get card get selected row
this method retrieves the card that is currently selected in the table
public void add card card card list table clear selection cards add card card select card card
this method is used to add a card to the card list panel
public card list get card list return cards
this method is returns the card list currently displayed in the panel
protected void set win dim set size 400 240
this method sets the window size and is required by the parent class
protected int get selected row int t row list table get selected row if t row 0 return 1 t row my model indexes t row return t row
this method retrieves the row that is currently selected in the table
public void set column editable string col tag editable cols add col tag
this method is called to allow a column to be edited
public void list changed card list change event evt show list cards
this method is invoked when the card list is changed
private boolean is editable int col index return editable cols contains att strings col index
this method is used to determine if a table cell is editable
public boolean compare string card name if apply me return true return validate card card name
this is the public method to be called to validate a card
protected void add filter filter sub panel panel panel add change listener new filter change listener public void filter changed filter change event evt trigger filter filters add panel
this method adds a filter to the card list filter
public void filter changed if apply me notify listeners
this method notifies listeners when the filter criteria changed
public void set apply boolean apply apply me apply notify listeners
this method is used to set whether this filter should be applied
public void set auto apply boolean auto if apply panel null apply panel auto apply auto
this method allows the user to override the default card list filter behavior
public string get label return set s
this method sets the string that will be shown on the gui
protected void track progress filtered list new vector int num filters filters size int num cards master list size boolean fits filter false string card null for int j 0 j num cards j if thread current thread is interrupted filtered list master list return tracker set progress j card string master list get j fits filter true for int i 0 i num filters i fits filter filter sub panel filters get i compare card if fits filter break end for filters if fits filter filtered list add card end for cards end of do filter
this method applies the filter with the currently selected criteria
public void add cards vector cards master list cards do filter
this method adds cards to the panel
public void master list changed system out println master list changed adding cards add cards master card list get instance get card list
this method is invoked when the master card list is changed
protected boolean validate card string card name vector sets get selected sets int num sets sets size string card sets master card list get instance get sets for card card name to string for int i 0 i num sets i system err println card sets if 1 card sets index of string sets get i return true return false
this method validates a card based on its sets expansions
protected void set init state close mi set enabled false main panel set visible false main panel remove all
this method is used to set the application to its initial state i
public string get label return mana cost
this method sets the string that will be shown on the gui
public void confirm then quit string message do you really want to exit if new yes no dialog message get answer system exit 0
this method asks the user if they really want to quit
protected void set init state close mi set enabled false deck lbl set visible false sb lbl set visible false deck panel remove all sb panel remove all prop panel reset repaint
this method is used to set the application to its initial state i
protected void right to left int num cards if source panel null dest panel null return card move card dest panel get selected card if move card null return move card new card move card get name move card set count num cards dest panel remove card move card
this method removes the specified number of copies of the selected card
public boolean is prefix active return false
returns if a prefix key has been pressed
public int get repeat count return repeat repeat count 0 repeat count 1
returns the number of times the next action will be repeated
public void set repeat count int repeat count repeat true this repeat count repeat count
sets the number of times the next action will be repeated
public edit action get last action return last action
returns the last executed action
public int get last action count return last action count
returns the number of times the last action was executed
public void read next char string msg string code view get status bar set message msg read next char code
invokes the specified bean shell code replacing char in the
public boolean is plugin action return plugin
returns true if this action was loaded from a plugin false
public void invoke view view default implementation action event evt new action event view action event action performed null action performed evt
invokes the action
public boolean is toggle return false
returns if this edit action should be displayed as a check box
public boolean no repeat return false
returns if this edit action should not be repeated
public boolean no record return false
returns if this edit action should not be recorded
public string get code return view get input handler invoke action j edit get action name
returns the bean shell code that will replay this action
public void action performed action event evt let input handler do recording repeating etc system out println wrapper action performed component source component evt get source view view edit action get view source system out println view view if view null system out println edit action action performed xxx no view else view get input handler invoke action action
called when the user selects this action from a menu
protected void close deck main deck get card list remove change listener this sideboard get card list remove change listener this main deck clear sideboard clear prop panel reset main deck get card list add change listener this sideboard get card list add change listener this set menu states false open file new string
this method closes the current deck with no questions asked
protected boolean deck changed boolean result main deck get card list list changed result result sideboard get card list list changed return result
this method is used to determine if the current deck has changed
protected void build deck info panel deck info panel add prop panel
this method builds the panel that displays properties of the current deck
public void list changed card list change event evt if card list evt get source get names size 0 set menu states true
this method is invoked when a card list is changed
public void preference changed preference change event evt sb move panel set visible show sb cb is selected sb panel set visible show sb cb is selected
this method is invoked when the preference is changed
public event bus get event bus return this event bus
return the event bus that we use
protected void print string message system out println message
convenience to avoid typing system
public boolean can meet cost mana mana cost return false
returns the typical 1 0 1
public void pay for mana mana cost mana payment hint
the trick here is that x and colorless may be paid for in
public void set sideboard pile sideboard this sideboard sideboard
xxx magic specific
protected void init state super init state this turn this create turn this set state turn this turn xxx magic specific this set state stack new stack
establish any shared state currently the shared stack and
public void remove state change listener state change listener l this state change listeners remove l
this method is used to remove a state change listener
public model copy return null
xxx is it semantically correct to return a pile here
protected turn create turn return new turn this
create a turn object for the game type
public turn get turn return this turn
get the turn associated with this game
public void set max players int max players xxx make this a state change this max players max players xxx send event
establish the maximum number of players that can join this game
public void add string color int delta if color equals g this set green mana this get green mana delta else if color equals r this set red mana this get red mana delta else system out println mana add xxx finish me don t handle color
note colors are speificed by g r
public int get max players xxx get from state return this max players
get the maximum number of players allowed to join this game
protected string get new player id string id pid this id counter this id counter return id
allocate a new unique identifier for a player
public void add phase string phase name int index this submit action new add phase action this phase name index
xxx handle better clues than index
public void active updates boolean active updates this active updates active updates if this active updates fire state change
this method can be used to suppress event storms
public player get state player string key return player this game get state key
cast friendly helper
public string get turn description return
return a canonical description of turn
public void add note string note xxx do something
add an annotation to the game log
public card get card int index string card name string this unique card names get index return this get unique card card name
note that we have to pay the price of indirection we store
protected void synch with pile xxx system out println table model pile wrapper synch with pile int index 0 card card enumeration cards this base pile get cards enum while cards has more elements card card cards next element this track card card index index
xxx should never call this expensive and unnecessary
public action manager get action manager return this action manager
return the action manager associated with this game
protected void add pile aliases
add any protocol specific aliases to our pile map
protected void play card card system out println sample robot play card get name this get pile hand remove card card this layout card system out println laid out card get state location system out println adding card this get pile in play add card card
play card from hand to table in play
public string get name return string this get state name
get the players name
public void send chat string text players players system out println player send chat text this fire event bus event new chat event this text players
send a whispered chat to selected players
public string get default port for protocol string protocol return string this protocol to port get protocol
note that we return a string not an int
public void add other player player new player other player log info add other player this get name new player get name super add other player new player if new player this this local player new player establish network ids new player try this hand shake new player catch ioexception io exc master log error xxx hand shake failed xxx really should just be the game server starting the game but we can t figure that out from the netmage 1 0 protocol this get game start game
informs us that another player has joined the game
protected void notify change listeners string attr name object new value super notify change listeners
notify swing style list model listeners that we changed
protected void hand shake player player throws ioexception this test connection this trade names player
transmit pertinent info about the specified local player to
protected void add pile aliases note that deck has already been hacked in since it is required before game starts this add pile deck this get pile library this add pile hand this get pile hand this add pile grave this get pile graveyard xxx funky place to put this but we need it early if deck is not in place before we return we will panic synchronized this init cond this initialized true system out println notify this init cond notify
add some all lower case aliases so we dont have to do string
public void network event net mage event event string event label event log info remote player manager network event event get label event label event get label if event label equals lost connection this game remove player player event get value else event log warn remote player manager network event event label
handle network events like losing remote players
public void set buffered reader buffered reader reader this in reader
xxx kind of gross experimenting with best place for
protected void trade names player player send log info trade names this sendln nametrade this sendln player get name
exchange names with another player
public void transfer string from pile name string to pile name card card card spec transfer this get pile from pile name this get pile to pile name card
transfer the specified card from one pile to another
protected void setup state this init entity map
allow subclasses to set up conditions etc
public void add entity string id object entity entity log debug id entity this id to entity map put id entity if entity null this entity to idmap put entity id
add an id entity mapping and an entity id mapping
public string get one liner return this to string
mostly support for bus viewer
public string to xml string buffer buffer new string buffer this open xml buffer this append xmlattr buffer label this get label this append xmlattr buffer class this get class get name buffer append n this close xml buffer return buffer to string
xxx should probably be a dom so we can insert
protected void send network id this send network id this
xxx push down into net mage bridge not used by all
protected void send network id player player this sendln this get net id player
xxx push down into net mage bridge not used by all
protected void data listener throws ioexception
handle route all incoming network commands
protected string get message string message system out println get message try message this in read line recv log debug rcv message return message catch ioexception e system out println error while reading data return null
fetch a single line from the input
public string get state variable return string this get label
get the name of the state variable that changed
public void handle state change event net mage event event event log debug label event get label
xxx should be protected but a python subclass cant get to
protected object try typed value string str if str starts with bool return extract boolean value str else if str starts with point return extract point value str else if str starts with size return extract size value str else return null
xxx need to plug in tag handlers