input
stringlengths
10
828
output
stringlengths
5
107
public void add image string id buffered image image images put id image
adds a new image to the data handler
public void move left boolean down wants to move left down
called by game round when the player wants to move left
protected document get data return data
returns the xml structure used by the parser
public void set size vector v this size v
sets the size of the object
public void move right boolean down wants to move right down
called by game round when the player wants to move right
public level get level try return parent catch null pointer exception npe throw new illegal state exception the parent level of the object has not been set most likely because the object has not been added to a level
returns the level
public istate get state return current state
returns the current state object
public void do logic current state logic
calls do logic on the current state
public void draw igraphics g current state draw g
tells the current state to draw itself
public void set air resistance double air resistance this air resistance air resistance
sets the air resistance of the object
public double get air resistance return air resistance
returns the air resistance of the object
public game round get game round return game round
get the active game round object for this state
public void set stationary boolean stationary this stationary stationary
control whether object is stationary
public boolean is stationary return stationary
returns whether the object is stationary
public void shoot toggle boolean shoot is shooting shoot
set whether the player is shooting
public void set scale double scale this scale scale for abstract game object c children c set scale scale
set the scale of the object
public void add child abstract game object child children add child
adds a child abstract game object to this object
public boolean same direction evector v return direction check v 0
checks if the direction of the vector is the same
public boolean opposite direction evector v return direction check v 0
checks if the direction of the vector is the
public double get max velocity return max velocity
returns the maximum velocity of the object
public int get level required return this level required
method that return the level required to research this technology
public string get req code int num req code throws server exception if num req code 1 return this req1 code else if num req code 2 return this req2 code else if num req code 3 return this req3 code else throw new server exception server exception tech req not exists
method that return the code of the technology required
public int get req quantity int num req code throws server exception if num req code 1 return this req1 quantity else if num req code 2 return this req2 quantity else if num req code 3 return this req3 quantity else throw new server exception server exception tech req not exists
method that return the quantity of the code of the technology required
public int get turns remainded return this turns remained
method that return the number of turns remained to get this technology
public void set turns remained int turns this turns remained this turns remained turns
method that changes the number of turns remained to get this technology
private void build writer string file name throws server exception try file writer file out new file writer file name true buffered writer buffer out new buffered writer file out this out player new print writer buffer out catch ioexception e e print stack trace system err throw new server exception server exception file error
method that creates the flow to write on a file on the hd
public string to string string string to return null string to return t code this code t description this description t level required this level required t turns required this turns remained have technologies required if this req1 quantity 0 string to return t tech 1 required this req1 quantity of this req1 code if this req2 quantity 0 string to return t tech 2 required this req2 quantity of this req2 code if this req3 quantity 0 string to return t tech 3 required this req3 quantity of this req3 code string to return n return string to return
creates a character string with the code description level required turns to get
public void add planet planet p planet throws server exception we verify that the planet isn t repeated in the game if v planets contains p planet throw new server exception server exception planet already exist else v planets add p planet
method that add a planet to the vector v planets
public void add player player p player v players add p player
method that add a player to the vector v players
private void build writer string file name throws server exception try file writer file out new file writer file name true buffered writer buffer out new buffered writer file out this out server new print writer buffer out catch ioexception e e print stack trace system err throw new server exception server exception file error
method that creates the flow to write on a file on the hd
public void add turn this current turn
method that add a turn to the current turn of the game
private void build writer string file name throws server exception try file writer file out new file writer file name true buffered writer buffer out new buffered writer file out this out new print writer buffer out catch ioexception e e print stack trace system err throw new server exception server exception file error
method that creates the flow to write on a file on the hd
public string get id game return this id game
method that returns the id of the game
public int get current turn return this current turn
method that returns the number of the current turn of the game
public void load file throws server exception string current line int line 0 boolean end false while end try current line in read line line if current line null current line equals try process command current line catch server exception e out println command error current line at line line out println e get message else end true catch ioexception ex ex print stack trace system err throw new server exception server exception file error
process the files or player orders
public string get status description string status string status description stringnotdefined if status i status description initialised if status n status description not playing just created if status p status description playing if status f status description finished return status description
method that returns the description of the status code
public int get id return this internal code
method that return the internal code of the planet
public string to string return t id this id game t description this description t status this get status description this status t date start this format date this date start t date end this format date this date end t current turn this current turn n
creates a character string with id game description status date start
private void build reader string file name throws server exception try file f new file file name in new buffered reader new input stream reader new file input stream f iso 8859 1 catch ioexception e e print stack trace system err throw new server exception server exception file error
method that creates the flow to read from a file on the hd
public string to string return n t name t this name this abbreviation n t language t this language n t flag t this flag n n
creates a character string with the name abbreviation language and
public void execute orders string p out throws server exception string current line int line 0 boolean end false while end try current line in read line line if current line null current line equals try process cof p out current line catch server exception e write msg to player order error current line at line line out println e get message else end true catch ioexception ex ex print stack trace system err throw new server exception server exception file error
process the in file
public string get filename assoc return this filename assoc
method that return the name of the graphical file of the planet
private vehicle search vehicle string id vehicle for int i 0 i this l vehicles size i if vehicle this l vehicles get i get id compare to id vehicle 0 return vehicle this l vehicles get i return null
method that returns a vehicle from his id
public string get town return this town
method that returns the town where the player lives
private void add planet p planet throws server exception check if planet already exists if l planets index of p planet 0 the planet doesn t exists we will add l planets add p planet else the planet already exists we will generates a exception throw new server exception server exception planet already exist
method that add a planet if and only if the planet doesnt exists
public string get country return this country player get name
method that returns the country where the player lives in the attribute
public int get number games played return this num games played
method that returns the number of the games played by the player
private technology search technology string code tech for int i 0 i this l technologies size i if technology this l technologies get i get code compare to code tech 0 return technology this l technologies get i return null
method that returns a technology in the game from his id
public int get dimension y return this dimension y
method that return the dimension y of the planet
public void set country country country this country player country
method that writes the country where the player lives in the attribute
private building search building string id building for int i 0 i this l buildings size i if building this l buildings get i get id compare to id building 0 return building this l buildings get i return null
method that returns a building from his id
private void add player p player throws server exception check if player already exists if l players index of p player 0 the player doesn t exists we will add l players add p player else the player already exists we will generates a exception throw new server exception server exception player already exist
method that add a player if and only if the player doesnt exists
public int get position x return this position x
method that return the position x of the planet
public race string id race string name string description string photo this id race id race this name name this description description this photo photo
constructor method of the class race
public string get id return this internal code
method that return the id of the building
private planet search planet int id planet for int i 0 i this l planets size i if planet this l planets get i get id id planet return planet this l planets get i return null
method that returns a planet from his id
public int get position y return this position y
method that return the position y of the planet
private void add technology p tech throws server exception check if technology already exists if l technologies index of p tech 0 the technology doesn t exists we will add l technologies add p tech else the technology already exists we will generates a exception throw new server exception server exception tech already exist
method that add a technology if and only if the technology doesnt exists
private player search player int id player for int i 0 i this l players size i if player this l players get i get id id player return player this l players get i return null
method that returns a player from his id
public int get num metal return this num metal
method that return the metal available quantity of the planet
public int get construction turns return this construction turns
method that return the number of turns that are needed to construct it
public string get consume creation return this consume creation
method that return the quantities that consume in the creation
public string get consume working return this consume working
method that return the quantities that consume meanwhile is working
public string get capacity return this capacity
method that return the capacity of charge
public int get num mineral return this num mineral
method that return the mineral available quantity of the planet
private int search player tech level int id player for int i 0 i l players size i if player l players get i get id id player return player l players get i get tech level return 1
method that returns the technology level of a player from his id
public int get technology level return this technology level
method that return the technology level that is needed to build this building
public int get production index return this production index
method that return the production index of the building
private int search player int id player for int i 0 i l players size i if l players get i get id id player return i return 1
method that returns a player from his id
public int get num water return this num water
method that return the water quantity available y of the planet
public string get planets int num planet if num planet v planets size return planet v planets element at num planet get name else return null
method that returns the list of planets owned by the player
public int get id return this id player
method that return the id player
public int get tech level return this tech level
method that return the technology level of the player
public personal details get personal details return this details
method that return de personal details of the player
public boolean get researching now return this researching now
method that return de the value of researching now of the player
public void set personal details personal details details this details details
method that writes the personal details of the player into the
public int get num food return this num food
method that return the food quantity available y of the planet
public void set researching now boolean status this researching now status
method that change the status of the researching now of the player
public string to string return t internal code this internal code t description this description t dimension this dimension x x this dimension y t symbol this symbol n
creates a character string with the internal code description dimension and symbol
public void add planet planet planet this v planets add planet
method that add a planet into the vector v planets
public void add technology technology tech this l technologies add tech
method that add a technology into the list l technologies
public technology search technology string code tech for int i 0 i this l technologies size i if technology this l technologies get i get code compare to code tech 0 return technology this l technologies get i return null
method that returns a technology from his id
private int search country string name country for int i 0 i l countries size i if l countries get i get name name country return i return 1
method that returns a country from his name
public int get num energy return this num energy
method that return the energy quantity available y of the planet
private void build writer string file name throws server exception file dir null if file name equals screen out new print writer system out true else try file f if dir null f new file dir file name else f new file file name out new print writer new buffered writer new output stream writer new file output stream f get absolute path false iso 8859 1 catch ioexception e e print stack trace system err throw new server exception server exception file error
method that creates the flow to write on a file on the hd
private void build reader string file name throws server exception try if file name equals keyboard in new buffered reader new input stream reader system in iso 8859 1 else file f new file file name in new buffered reader new input stream reader new file input stream f iso 8859 1 catch ioexception e e print stack trace system err throw new server exception server exception file error
method that creates the flow to read from a file on the hd
public void close streams throws server exception try in close out close catch ioexception e e print stack trace system err throw new server exception server exception file error
method that closes the flows from the files on the hd
public int get num credits return this num credits
method that return the credits quantity available y of the planet
public int get movement index return this movement index
method that return the index of movement
public int get landing takeoff turns return this landing takeoff turns
method that return the number of turns that are needed to takeoff or
private int search planet int id planet for int i 0 i l planets size i if l planets get i get id id planet return i return 1
method that returns a planet from his id
public int get taxes return this taxes
method that return the percentage of the taxes applieds of the planet
private void load planets data int index int ic l planets get index get id jtf internal code ic jtf filename assoc l planets get index get filename assoc jtf planet name l planets get index get name jtf description l planets get index get description
load data from l planets and show in the screen
public string to string return t internal code this internal code t description this description t symbol this symbol n
creates a character string with the internal code description symbol
public int get temperature return this temperature
method that return the temperature in celsius of the surface of the planet
private string list countries country country string countries list countries list n iterator country it for it this l countries iterator it has next country it next countries list country to string return countries list
method that return the list of all countries in the system
public int get radiation return this radiation
method that return the radiation in of the surface of the planet
public int get owner player return this owner player
method that return the player owner of the planet
private void clear text area jta mesgs select all jta mesgs replace selection
method that clear the text area before write new informaton
private string list buildings building building string buildings list buildings list n iterator building it for it this l buildings iterator it has next building it next buildings list building to string return buildings list
method that return the list of all buildings in the system