Class CRParser

    • Field Detail

      • log

        protected static final Logger log
      • TAGGABLE_STRING

        public static final java.lang.String TAGGABLE_STRING
        These special tags are used by TreeHelper and are therefore reserved.
        See Also:
        Constant Field Values
      • TAGGABLE_STRING2

        public static final java.lang.String TAGGABLE_STRING2
        These special tags are used by TreeHelper and are therefore reserved.
        See Also:
        Constant Field Values
      • TAGGABLE_STRING3

        public static final java.lang.String TAGGABLE_STRING3
        These special tags are used by TreeHelper and are therefore reserved.
        See Also:
        Constant Field Values
      • TAGGABLE_STRING4

        public static final java.lang.String TAGGABLE_STRING4
        These special tags are used by TreeHelper and are therefore reserved.
        See Also:
        Constant Field Values
      • TAGGABLE_STRING5

        public static final java.lang.String TAGGABLE_STRING5
        These special tags are used by TreeHelper and are therefore reserved.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CRParser

        public CRParser​(UserInterface ui)
        Creates a new parser.
        Parameters:
        ui - The UserInterface for the progress. Can be NULL. Then no operation is displayed.
      • CRParser

        public CRParser​(UserInterface ui,
                        ReportTransformer translator)
        Creates a new parser. This new parser translates coordinates according to newOrigin. All coordinates which are read from the report are translated by newOrigin. That is, if a coordinate read and its level (the z coordinate) equals the new origins level, its x and y coordinates are decreased by origin.x and origin.y, respectively. That means, that the reports origin is transferred to newOrigin.
        Parameters:
        translator - The coordinates (relative to the origin of the report) of the new origin.
    • Method Detail

      • getConfiguration

        public java.lang.String getConfiguration()
        Returns the value of the configuration tag ("Konfiguration") as it has been read from the CR.
        Returns:
        The configuration string or null if the tag hasn't been read (yet)
      • unknown

        protected void unknown​(java.lang.String context,
                               boolean fetch)
                        throws java.io.IOException
        Print an error message on the standard output channel. Does not produce duplicate messages.
        Parameters:
        context - The context (usually a block) within the error has been found.
        fetch - If this is true, read the next line and skip the line with the error. Otherwise the line stays still at the front of the input.
        Throws:
        java.io.IOException
      • unknown

        protected void unknown​(java.lang.String context,
                               boolean fetch,
                               int logLevel)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readHeader

        public java.util.Map<java.lang.String,​java.lang.Object> readHeader​(java.io.Reader in)
                                                                          throws java.io.IOException
        Reads the header and stores the tags in a map.
        Parameters:
        in - The reader, that will read the file for us.
        Returns:
        a map, that maps all found header tags to their values.
        Throws:
        java.io.IOException - If an I/O error occurs
      • readRules

        public Rules readRules​(FileType filetype)
                        throws java.io.IOException
        Read a ruleset from a specified file.
        Specified by:
        readRules in interface RulesIO
        Throws:
        java.io.IOException - If an I/O error occurs
      • parseBookmark

        protected BookmarkBuilder parseBookmark​(Selectable object)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public GameData read​(java.io.Reader in,
                             GameData data)
                      throws java.io.IOException
        This function parses the informations found in Reader in and creates a corresponding GameData object tree.
        Specified by:
        read in interface GameDataIO
        Parameters:
        in - Reader to cr file
        data - GameData to be filled with informations of given cr file This function is synchronized.
        Returns:
        The (modified) world
        Throws:
        java.io.IOException - If an I/O error occurs
        See Also:
        GameDataIO.read(java.io.Reader, magellan.library.GameData)