Interface UnitContainer

    • Method Detail

      • addItem

        Item addItem​(Item i)
        Adds an item to the UnitContainer. If the UnitContainer already has an item of the same type, the item is overwritten with the specified item object.
        Returns:
        the specified item i.
      • getItems

        java.util.Collection<Item> getItems()
        Returns all the items this container possesses.
        Returns:
        a collection of Item objects.
      • setType

        void setType​(UnitContainerType t)
        DOCUMENT-ME
        Throws:
        java.lang.IllegalArgumentException - DOCUMENT-ME
      • getData

        GameData getData()
        Returns the associated GameData
      • setSortIndex

        void setSortIndex​(int index)
        Sets an index indicating how instances of class are sorted in the report.
        Specified by:
        setSortIndex in interface Sorted
      • getSortIndex

        int getSortIndex()
        Returns an index indicating how instances of class are sorted in the report.
        Specified by:
        getSortIndex in interface Sorted
      • units

        java.util.Collection<Unit> units()
        Returns an unmodifiable collection of all the units in this container.
      • getUnit

        Unit getUnit​(ID key)
        Retrieve a unit in this container by id.
      • addUnit

        void addUnit​(Unit u)
        Adds a unit to this container. This method should only be invoked by Unit.setXXX() methods.
      • removeUnit

        Unit removeUnit​(ID key)
        Removes a unit from this container. This method should only be invoked by Unit.setXXX() methods.
      • modifiedUnits

        java.util.Collection<Unit> modifiedUnits()
        DOCUMENT-ME
      • getModifiedUnit

        Unit getModifiedUnit​(ID key)
        Returns the unit with the specified ID if it is in the modified units, null otherwise.
      • getOwner

        Unit getOwner()
        Returns value of the owner tag of the UnitContainer or null. Most callers should use getOwnerUnit() instead!
        Returns:
        The current owner of the UnitContainer or null.
      • setOwner

        void setOwner​(Unit owner)
        Set the value of the owner tag.
        Parameters:
        owner -
      • setOwnerUnit

        void setOwnerUnit​(Unit unit)
        Sets the unit owning this UnitContainer. You should probably use setOwner(Unit) instead!
        Parameters:
        unit -
      • getOwnerUnit

        Unit getOwnerUnit()
        Returns the unit owning this UnitContainer. If this UnitContainer is an instance of class Ship or Building the normal owning unit is returned (or null, if there is none). In case of a Region, the OwnerUnit of the largest castle is returned. In case of a Faction, null is returned.
      • getModifiedOwnerUnit

        Unit getModifiedOwnerUnit()
        Returns the unit owning this UnitContainer after orders have been executed. If this UnitContainer is an instance of class Ship or Building the normal owning unit is returned (or null, if there is none). In case of a Region, the OwnerUnit of the largest castle is returned. In case of a Faction, null is returned.
      • getComments

        java.util.List<java.lang.String> getComments()
        Returns the value of comments.
        Returns:
        Returns comments.
      • setComments

        void setComments​(java.util.List<java.lang.String> comments)
        Sets the value of comments.
        Parameters:
        comments - The value for comments.
      • getEffects

        java.util.List<java.lang.String> getEffects()
        Returns the value of effects.
        Returns:
        Returns effects.
      • setEffects

        void setEffects​(java.util.List<java.lang.String> effects)
        Sets the value of effects.
        Parameters:
        effects - The value for effects.
      • getOrderEditor

        CacheableOrderEditor getOrderEditor()
        Always returns null. UnitContainers do not have order editors.
        Returns:
        null
      • getUnits

        java.util.Map<? extends ID,​Unit> getUnits()