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​( in)
        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: - 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)
      • normalize

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

        protected void firstHandle​(java.lang.String line)
      • 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 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
        doNotOverwriteConfirmedOrders - The value for doNotOverwriteConfirmedOrders.