Interface OrderChanger

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALL
      Code for ALL in commands like GIVE xyz ALL item, used in addGiveOrder.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void addCombatOrder​(Unit unit, int newstate)
      Adds a KÄMPFE order.
      void addDescribeUnitContainerOrder​(Unit unit, UnitContainer uc, java.lang.String descr)
      Adds a command line "DESCRIBE uc \"descr\"" ("BESCHREIBE uc \"descr\"") , e.g.
      void addDescribeUnitOrder​(Unit unit, java.lang.String descr)
      Adds a command line "DESCRIBE UNIT \"descr\"" ("BESCHREIBE EINHEIT \"descr\"") , e.g.
      void addDescribeUnitPrivateOrder​(Unit unit, java.lang.String descr)
      Adds a command line "DESCRIBE PRIVATE \"descr\"" ("BESCHREIBE PRIVAT \"descr\"") , e.g.
      void addGiveOrder​(Unit source, Unit target, int amount, StringID item, java.lang.String comment)
      Adds a GIVE target amount item order.
      void addGroupOrder​(Unit unit, java.lang.String name)
      Adds a command line "GROUP \"name\"" ("GRUPPE \"name\"") , e.g.
      void addHideOrder​(Unit unit, java.lang.String level)
      Adds a command line "HIDE newstate" ("TARNE newstate") , e.g.
      void addMultipleHideOrder​(Unit u)
      Adds command lines for hiding all that could identify this unit, like name, number, description etc.
      void addNamingOrder​(Unit unit, java.lang.String name)
      Adds a command line "NAME UNIT \"name\"" ("BENENNE EINHEIT \"name\"") , e.g.
      void addNamingOrder​(Unit unit, UnitContainer uc, java.lang.String name)
      Adds a command line "NAME uc \"name\"" ("BENENNE uc \"name\"") , e.g.
      void addRecruitOrder​(Unit u, int amount)
      Adds a REKRUTIERE amount order.
      int areCompatibleLongOrders​(Orders orders)
      Determines if the orders in the collection are legal to have at the same time for one unit.
      Order createOrder​(Unit unit, java.lang.String order)
      Turns line of text into an Order object.
      void disableLongOrders​(Unit u)
      searches the orders of the unit for long orders and comments them out
      int extractTempUnits​(GameData gdata, int tempSortIndex, java.util.Locale locale, Unit unit)
      Scans this unit's orders for temp units to create.
      java.lang.String getOrder​(java.util.Locale orderLocale, StringID orderId)
      Deprecated. 
      java.lang.String getOrder​(java.util.Locale orderLocale, StringID orderId, java.lang.Object[] args)
      Deprecated. 
      java.lang.String getOrder​(StringID orderId, java.util.Locale orderLocale)
      Deprecated. 
      java.lang.String getOrder​(StringID orderId, java.util.Locale orderLocale, java.lang.Object[] args)
      Deprecated. 
      Order getOrderO​(java.util.Locale orderLocale, StringID orderId)
      Returns localized order for given order id
      Order getOrderO​(java.util.Locale orderLocale, StringID orderId, java.lang.Object[] args)
      Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
      Order getOrderO​(StringID orderId, java.util.Locale orderLocale)
      Returns localized order for given order id
      Order getOrderO​(StringID orderId, java.util.Locale orderLocale, java.lang.Object[] args)
      Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
      java.util.Collection<? extends Order> getTempOrders​(boolean writeUnitTagsAsVorlageComment, Unit unit)
      Returns the orders necessary to issue the creation of all the child temp units of this unit.
      java.lang.String getTokenLocalized​(java.util.Locale orderLocale, java.lang.Object arg)
      Returns localized string for given locale and argument.
      boolean isLongOrder​(java.lang.String order)
      Deprecated.
      the results of this order are not very accurate and order is always interpreted in the global order locale.
      boolean isLongOrder​(Order order)
      checks, if the given order is a long order
      void setLongOrders​(Unit u, java.util.List<java.lang.String> orders, boolean replaceAll)
      Replace incompatible long orders of unit with new long orders.
    • Field Detail

      • ALL

        static final int ALL
        Code for ALL in commands like GIVE xyz ALL item, used in addGiveOrder.
        See Also:
        Constant Field Values
    • Method Detail

      • createOrder

        Order createOrder​(Unit unit,
                          java.lang.String order)
        Turns line of text into an Order object.
      • addDescribeUnitContainerOrder

        void addDescribeUnitContainerOrder​(Unit unit,
                                           UnitContainer uc,
                                           java.lang.String descr)
        Adds a command line "DESCRIBE uc \"descr\"" ("BESCHREIBE uc \"descr\"") , e.g. "DESCRIBE SHIP \"A wonderful small boat.\"" ("BESCHREIBE SCHIFF \"Ein wundervolles kleines Boot.\"") to the given unit. See EMapDetailsPanel.
      • addDescribeUnitOrder

        void addDescribeUnitOrder​(Unit unit,
                                  java.lang.String descr)
        Adds a command line "DESCRIBE UNIT \"descr\"" ("BESCHREIBE EINHEIT \"descr\"") , e.g. "DESCRIBE UNIT \"A wonderful sailor.\"" ("BESCHREIBE EINHEIT \"Ein wundervoller Segler.\"") to the given unit. See EMapDetailsPanel.
      • addDescribeUnitPrivateOrder

        void addDescribeUnitPrivateOrder​(Unit unit,
                                         java.lang.String descr)
        Adds a command line "DESCRIBE PRIVATE \"descr\"" ("BESCHREIBE PRIVAT \"descr\"") , e.g. "DESCRIBE PRIVATE \"My spy!.\"" ("BESCHREIBE PRIVAT \"Mein Spion!\"") to the given unit. See EMapDetailsPanel.
      • addHideOrder

        void addHideOrder​(Unit unit,
                          java.lang.String level)
        Adds a command line "HIDE newstate" ("TARNE newstate") , e.g. "HIDE 3" ("TARNE 3") to the given unit. See EMapDetailsPanel.
      • addGroupOrder

        void addGroupOrder​(Unit unit,
                           java.lang.String name)
        Adds a command line "GROUP \"name\"" ("GRUPPE \"name\"") , e.g. "GROUP \"Magellan.\"" ("GRUPPE \"Magellan.\"") to the given unit. See EMapDetailsPanel.
      • addNamingOrder

        void addNamingOrder​(Unit unit,
                            java.lang.String name)
        Adds a command line "NAME UNIT \"name\"" ("BENENNE EINHEIT \"name\"") , e.g. "NAME UNIT \"Magellan.\"" ("BENENNE EINHEIT \"Magellan.\"") to the given unit. See EMapDetailsPanel.
      • addNamingOrder

        void addNamingOrder​(Unit unit,
                            UnitContainer uc,
                            java.lang.String name)
        Adds a command line "NAME uc \"name\"" ("BENENNE uc \"name\"") , e.g. "NAME SHIP \"Santa Barbara.\"" ("BENENNE SCHIFF \"Santa Barbara.\"") to the given unit. See EMapDetailsPanel.
      • addRecruitOrder

        void addRecruitOrder​(Unit u,
                             int amount)
        Adds a REKRUTIERE amount order.
      • addGiveOrder

        void addGiveOrder​(Unit source,
                          Unit target,
                          int amount,
                          StringID item,
                          java.lang.String comment)
        Adds a GIVE target amount item order.
        Parameters:
        amount - use ALL for all, negative amount for each
      • addMultipleHideOrder

        void addMultipleHideOrder​(Unit u)
        Adds command lines for hiding all that could identify this unit, like name, number, description etc.
        Parameters:
        u - The affected unit.
      • disableLongOrders

        void disableLongOrders​(Unit u)
        searches the orders of the unit for long orders and comments them out
        Parameters:
        u -
      • isLongOrder

        @Deprecated
        boolean isLongOrder​(java.lang.String order)
        Deprecated.
        the results of this order are not very accurate and order is always interpreted in the global order locale. It's safer to call OrderParser.parse(String, Locale).isLong() or isLongOrder(Order).
        checks, if the given order is a long order
        Parameters:
        order -
        Returns:
        true if the given order is a long order
      • isLongOrder

        boolean isLongOrder​(Order order)
        checks, if the given order is a long order
        Parameters:
        order -
        Returns:
        true if the given order is a long order
      • areCompatibleLongOrders

        int areCompatibleLongOrders​(Orders orders)
        Determines if the orders in the collection are legal to have at the same time for one unit.
        Parameters:
        orders -
        Returns:
        The number of the first offending order, -1 if the orders are compatible
      • getTokenLocalized

        java.lang.String getTokenLocalized​(java.util.Locale orderLocale,
                                           java.lang.Object arg)
                                    throws RulesException
        Returns localized string for given locale and argument.
        Parameters:
        orderLocale -
        arg - can be an order ID, a unit ID or anything else
        Throws:
        RulesException - if argument has no translation
      • getOrderO

        Order getOrderO​(java.util.Locale orderLocale,
                        StringID orderId)
        Returns localized order for given order id
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
      • getOrderO

        Order getOrderO​(java.util.Locale orderLocale,
                        StringID orderId,
                        java.lang.Object[] args)
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
      • getOrderO

        Order getOrderO​(StringID orderId,
                        java.util.Locale orderLocale)
                 throws RulesException
        Returns localized order for given order id
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        Throws:
        RulesException - if argument has no translation
      • getOrderO

        Order getOrderO​(StringID orderId,
                        java.util.Locale orderLocale,
                        java.lang.Object[] args)
                 throws RulesException
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
        Throws:
        RulesException - if argument has no translation
      • getOrder

        @Deprecated
        java.lang.String getOrder​(java.util.Locale orderLocale,
                                  StringID orderId)
        Deprecated.
        Returns localized order for given order id
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
      • getOrder

        @Deprecated
        java.lang.String getOrder​(java.util.Locale orderLocale,
                                  StringID orderId,
                                  java.lang.Object[] args)
        Deprecated.
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
      • getOrder

        @Deprecated
        java.lang.String getOrder​(StringID orderId,
                                  java.util.Locale orderLocale)
                           throws RulesException
        Deprecated.
        Returns localized order for given order id
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        Throws:
        RulesException - if argument has no translation
      • getOrder

        @Deprecated
        java.lang.String getOrder​(StringID orderId,
                                  java.util.Locale orderLocale,
                                  java.lang.Object[] args)
                           throws RulesException
        Deprecated.
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
        Throws:
        RulesException - if argument has no translation
      • extractTempUnits

        int extractTempUnits​(GameData gdata,
                             int tempSortIndex,
                             java.util.Locale locale,
                             Unit unit)
        Scans this unit's orders for temp units to create. It constructs them as TempUnit objects and removes the corresponding orders from this unit.
        Parameters:
        tempSortIndex - an index for sorting units (required to reconstruct the original order in the report) which is incremented with each new temp unit.
        locale - the locale to parse the orders with.
        Returns:
        the new sort index. return value - sortIndex is the number of temp units read from this unit's orders.
      • getTempOrders

        java.util.Collection<? extends Order> getTempOrders​(boolean writeUnitTagsAsVorlageComment,
                                                            Unit unit)
        Returns the orders necessary to issue the creation of all the child temp units of this unit.
      • setLongOrders

        void setLongOrders​(Unit u,
                           java.util.List<java.lang.String> orders,
                           boolean replaceAll)
        Replace incompatible long orders of unit with new long orders. All orders that are not compatible with new orders are removed. If the new orders are already not compatible, no old orders are removed.
        Parameters:
        u - the unit
        orders - new orders
        replaceAll - If true, all the unit's orders are replaced