Class GameDataReader


  • public class GameDataReader
    extends java.lang.Object
    The GameDataReader reads a GameData from a given FileType
    Version:
    $Revision: 302 $
    Author:
    $Author: $
    • Constructor Detail

      • GameDataReader

        public GameDataReader​(UserInterface ui)
        Constructs a new GameDataReader
        Parameters:
        ui - The UserInterface for the progress. Can be NULL. Then no operation is displayed.
    • Method Detail

      • readGameData

        public GameData readGameData​(FileType aFileType)
                              throws java.io.IOException
        Read a gamedata from a given File. At the beginning the game name is read by a GameNameReader. With this name the corresponding rules and game
        Parameters:
        aFileType - the filetype representing a cr or xml file.
        Returns:
        a GameData object read from the cr or xml file.
        Throws:
        java.io.IOException - iff something went wrong while reading the file.
      • readGameData

        public GameData readGameData​(FileType aFileType,
                                     ReportTransformer transformer)
                              throws java.io.IOException
        Read a gamedata from a given File. At the beginning the game name is read by a GameNameReader. With this name the corresponding rules and game can be parsed.
        Parameters:
        aFileType - the filetype representing a cr or xml file.
        transformer - the loaded report is translated by this transformer.
        Returns:
        a GameData object read from the cr or xml file.
        Throws:
        java.io.IOException - If an I/O error occurs
      • readGameData

        @Deprecated
        public GameData readGameData​(FileType aFileType,
                                     CoordinateID newOrigin,
                                     java.lang.String gameName)
                              throws java.io.IOException
        Deprecated.
        Throws:
        java.io.IOException
      • readGameData

        public GameData readGameData​(FileType aFileType,
                                     ReportTransformer coordinateTransformer,
                                     java.lang.String gameName)
                              throws java.io.IOException
        Read a gamedata from a given File.
        Parameters:
        aFileType - the filetype representing a cr or xml file.
        coordinateTransformer - the loaded report is translated by this transformer.
        gameName -
        Returns:
        a GameData object read from the cr or xml file.
        Throws:
        java.io.IOException - If an I/O error occurs
      • readGameDataXML

        protected GameData readGameDataXML​(FileType aFileType,
                                           java.lang.String aGameName)
                                    throws java.io.IOException
        Reads game data from a XML file
        Throws:
        java.io.IOException
      • readGameDataXML

        protected GameData readGameDataXML​(FileType aFileType,
                                           java.lang.String aGameName,
                                           ReportTransformer coordinateTranslator)
                                    throws java.io.IOException
        Reads game data from a XML file
        Throws:
        java.io.IOException
      • readGameDataCR

        protected GameData readGameDataCR​(FileType aFileType,
                                          java.lang.String aGameName)
                                   throws java.io.IOException
        Reads the game data from a CR file
        Throws:
        java.io.IOException
      • readGameDataCR

        protected GameData readGameDataCR​(FileType aFileType,
                                          java.lang.String aGameName,
                                          ReportTransformer coordinateTranslator)
                                   throws java.io.IOException
        Reads the game data from a CR file
        Parameters:
        aFileType - The CR file
        aGameName -
        coordinateTranslator - the loaded report is translated by this coordinates.
        Returns:
        A new GameData object filled in with the information from the file.
        Throws:
        java.io.IOException - If an I/O error occurs
      • createGameData

        public GameData createGameData​(java.lang.String aGameName)
                                throws java.io.IOException
        Creates a new GameData based on the gamename rules.
        Parameters:
        aGameName - The game name whose rules are being read.
        Returns:
        A new, empty GameData object
        Throws:
        java.io.IOException - If an I/O error occurs or no rules could be found.