edu.princeton.repeatedgames.rgsolve.utilities
Class RGSolveIO

java.lang.Object
  extended by edu.princeton.repeatedgames.rgsolve.utilities.RGSolveIO

public class RGSolveIO
extends java.lang.Object

This class contains IO methods for saving and opening files


Nested Class Summary
static class RGSolveIO.OpenGameReturnObject
          Contains a StageGame object and its title/name and extension
static class RGSolveIO.SpecialFileFilter
          This class is used for extracting the extensions from files so that they can be opened/parsed properly by rgsolve
 
Field Summary
static java.lang.String FILE_SEPARATOR
          The file separator on this system
static java.lang.String GAMES_FOLDER
          The default location of saved games
static java.lang.String[] IO_game_options
           
static java.lang.String[] IO_game_options_user_code
           
static java.lang.String OUTPUT_FOLDER
          the default location of text output or graph output
static java.lang.String SOLN_FOLDER
          The default location of game solutions
 
Constructor Summary
RGSolveIO()
           
 
Method Summary
static RGSolveIO.OpenGameReturnObject openSavedGame()
          Open a saved game in the formats .txt, .rgm, .gmcode or .mat
static RGSolution openSolution()
          This method opens and instantiates a serialized RGSolution object
static boolean saveSolution(RGSolution rgsro)
          This method serializes and saves an RGSolution object
static java.lang.String writeGameFile(Game gm, java.lang.String file_title)
          This methods and saves game files as - .rgm (serialized games).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SEPARATOR

public static final java.lang.String FILE_SEPARATOR
The file separator on this system


GAMES_FOLDER

public static final java.lang.String GAMES_FOLDER
The default location of saved games

See Also:
Constant Field Values

SOLN_FOLDER

public static final java.lang.String SOLN_FOLDER
The default location of game solutions

See Also:
Constant Field Values

OUTPUT_FOLDER

public static final java.lang.String OUTPUT_FOLDER
the default location of text output or graph output

See Also:
Constant Field Values

IO_game_options

public static java.lang.String[] IO_game_options

IO_game_options_user_code

public static java.lang.String[] IO_game_options_user_code
Constructor Detail

RGSolveIO

public RGSolveIO()
Method Detail

writeGameFile

public static java.lang.String writeGameFile(Game gm,
                                             java.lang.String file_title)
This methods and saves game files as - .rgm (serialized games). - .mat (access database, readable in matlab). - .txt (text files). - .gmcode (special format for storing source from user-defined rules).

Parameters:
gm - the game to be saved
file_title - the title of the game that is passed in
Returns:
the title of the saved game

openSavedGame

public static RGSolveIO.OpenGameReturnObject openSavedGame()
Open a saved game in the formats .txt, .rgm, .gmcode or .mat

Returns:
an OpenGameReturnObject object that contains a game and its title

openSolution

public static RGSolution openSolution()
This method opens and instantiates a serialized RGSolution object

Returns:
the solution object

saveSolution

public static boolean saveSolution(RGSolution rgsro)
This method serializes and saves an RGSolution object

Parameters:
rgsro - solution to save
Returns:
whether the save was succesful