Interface Orders

  • All Superinterfaces:
    java.util.Collection<Order>, java.lang.Iterable<Order>, java.util.List<Order>
    All Known Implementing Classes:
    MagellanOrdersImplementation

    public interface Orders
    extends java.util.List<Order>
    A class representing a unit's orders. It extends the List interface, but only supports the read-only methods.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getNumber​(Order order, int pos)
      Returns the integer number represented by the specified token in the order.
      Unit getUnit()
      Returns the unit owning these orders.
      boolean isToken​(Order order, int pos, StringID token)
      Compares an order token to a order constant.
      boolean removeOrder​(Order order, int length)
      Removes orders that match the given order up to a given length.
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
    • Method Detail

      • removeOrder

        boolean removeOrder​(Order order,
                            int length)
        Removes orders that match the given order up to a given length.
        Parameters:
        order - pattern to remove
        length - denotes the number of tokens that need to be equal for a replacement. E.g. specify 2 if order is "BENENNE EINHEIT abc" and all "BENENNE EINHEIT" orders should be replaced but not all "BENENNE" orders.
        Returns:
        true if at least one order was removed
      • getUnit

        Unit getUnit()
        Returns the unit owning these orders. It is not guaranteed, that this orders object is actually attached to the unit.
        Returns:
        The unit owning these orders.
      • isToken

        boolean isToken​(Order order,
                        int pos,
                        StringID token)
        Compares an order token to a order constant. This method translates the token to the unit's order locale and compares it to the specified order token.
        Parameters:
        order - An order
        pos - A token position
        token - An order name. Usually one of the order ("O_...") constants from EresseaConstants.
        Returns:
        true if the order token at the position is a significant prefix of the translation of the given order token
        See Also:
        OrderToken.equalsLocalToken(String)
      • getNumber

        int getNumber​(Order order,
                      int pos)
        Returns the integer number represented by the specified token in the order.