Class OrderReader

    • Field Detail

      • command

        protected java.lang.String command
      • comment

        protected java.lang.String comment
      • currentFaction

        protected Faction currentFaction
      • currentUnit

        protected Unit currentUnit
      • currentRegion

        protected java.lang.String currentRegion
    • Constructor Detail

      • OrderReader

        public OrderReader​(GameData g)
        Creates a new OrderReader object adding the read orders to the units it can find in the specified game data object. This function clears the caches of all units.
    • Method Detail

      • read

        public void read​(java.io.Reader in)
                  throws java.io.IOException
        Reads the orders from the specified Reader. Orders for multiple factions can be read. Region lines are ignored. Unit are not created. If there are orders for a unit that cannot be found in the game data these orders are ignored. Lines containing ECHECK comments are always ignored. Comments starting with a semicolon and containing the literal 'bestaetigt' (case and umlaut insensitive) after an arbitrary number of whitespace characters are never added to a unit's orders, instead they set the order confirmation status of the unit to true.
        Specified by:
        read in interface GameSpecificOrderReader
        Throws:
        java.io.IOException - if an I/O error occurs
      • splitLine

        protected void splitLine​(java.lang.String line)
      • initHandlers

        protected void initHandlers()
      • applyHandler

        protected java.util.List<OrderReader.LineHandler> applyHandler​(java.lang.String line)
                                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • normalize

        protected java.lang.String normalize​(java.lang.String token)
      • firstHandle

        protected void firstHandle​(java.lang.String line)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • defaultHandle

        protected void defaultHandle​(java.lang.String line)
      • commentHandle

        protected void commentHandle​(java.lang.String line)
      • endHandler

        protected void endHandler()
      • endFaction

        protected void endFaction()
      • getOrderTranslation

        protected java.lang.String getOrderTranslation​(StringID orderId)
      • setAutoConfirm

        public void setAutoConfirm​(boolean autoConfirm)
        Sets whether all read orders get automatically confirmed.
        Specified by:
        setAutoConfirm in interface GameSpecificOrderReader
      • isIgnoringSemicolonComments

        public boolean isIgnoringSemicolonComments()
        Returns whether all comments in the orders starting with a semicolon (except confirmation comments) are ignored.
        Specified by:
        isIgnoringSemicolonComments in interface GameSpecificOrderReader
      • setIgnoreSemicolonComments

        public void setIgnoreSemicolonComments​(boolean ignoreSemicolonComments)
        Sets whether all comments in the orders starting with a semicolon (except confirmation comments) are ignored.
        Specified by:
        setIgnoreSemicolonComments in interface GameSpecificOrderReader
      • isDoNotOverwriteConfirmedOrders

        public boolean isDoNotOverwriteConfirmedOrders()
        Returns whether orders of confirmed units should be overwritten.
        Specified by:
        isDoNotOverwriteConfirmedOrders in interface GameSpecificOrderReader
        Returns:
        Returns doNotOverwriteConfirmedOrders.
      • setDoNotOverwriteConfirmedOrders

        public void setDoNotOverwriteConfirmedOrders​(boolean doNotOverwriteConfirmedOrders)
        Sets whether orders of confirmed units should be overwritten. If set to true, orders of confirmed units will not be changed.
        Specified by:
        setDoNotOverwriteConfirmedOrders in interface GameSpecificOrderReader
        Parameters:
        doNotOverwriteConfirmedOrders - The value for doNotOverwriteConfirmedOrders.