Class MagellanGroupImpl

    • Constructor Detail

      • MagellanGroupImpl

        public MagellanGroupImpl​(IntegerID id,
                                 GameData data)
        Create a new Group object.
        Parameters:
        id - the id of this group.
        data - the game data this group belongs to.
      • MagellanGroupImpl

        public MagellanGroupImpl​(IntegerID id,
                                 GameData data,
                                 java.lang.String name)
        Create a new Group object.
        Parameters:
        id - the id of this group.
        data - the game data this group belongs to.
        name - the name of this group.
      • MagellanGroupImpl

        public MagellanGroupImpl​(IntegerID id,
                                 GameData data,
                                 java.lang.String name,
                                 Faction faction)
        Create a new Group object.
        Parameters:
        id - the id of this group.
        data - the game data this group belongs to.
        name - the name of this group.
        faction - the faction this group belongs to.
    • Method Detail

      • setFaction

        public void setFaction​(Faction f)
        Set the faction this group belongs to.
        Specified by:
        setFaction in interface Group
      • getFaction

        public Faction getFaction()
        Get the faction this group belongs to.
        Specified by:
        getFaction in interface Group
      • allies

        public java.util.Map<EntityID,​Alliance> allies()
        The alliances specific to this group. The map returned by this function contains ID objects as keys with the id of the faction that alliance references. The values are instances of class Alliance. The return value is never null.
        Specified by:
        allies in interface Group
      • setRaceNamePrefix

        public void setRaceNamePrefix​(java.lang.String prefix)
        Sets the group dependent prefix for the race name.
        Specified by:
        setRaceNamePrefix in interface Group
      • getRaceNamePrefix

        public java.lang.String getRaceNamePrefix()
        Returns the group dependent prefix for the race name.
        Specified by:
        getRaceNamePrefix in interface Group
      • setSortIndex

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

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

        public java.util.Collection<Unit> units()
        Returns an unmodifiable collection of all the units in this container.
        Specified by:
        units in interface Group
      • getUnit

        public Unit getUnit​(ID key)
        Retrieve a unit in this container by id.
        Specified by:
        getUnit in interface Group
      • addUnit

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

        public Unit removeUnit​(ID key)
        Removes a unit from this container. This method should only be invoked by Unit.setXXX() methods.
        Specified by:
        removeUnit in interface Group
      • toString

        public java.lang.String toString()
        Returns a String representation of this group object.
        Specified by:
        toString in interface Group
        Overrides:
        toString in class MagellanNamedImpl
      • getTag

        public java.lang.String getTag​(java.lang.String tag)
        Description copied from interface: Taggable
        Return the value of the tag with key tag from this object.
        Specified by:
        getTag in interface Taggable
        Returns:
        The value of the tag tag or null if no such tag exists.
        See Also:
        Taggable.getTag(java.lang.String)
      • getTagMap

        public java.util.Map<java.lang.String,​java.lang.String> getTagMap()
        Description copied from interface: Taggable
        Returns a Map containing all tags and their values associated with this object.
        Specified by:
        getTagMap in interface Taggable
        See Also:
        Taggable.getTagMap()
      • hasTags

        public boolean hasTags()
        Description copied from interface: Taggable
        Returns true if there are any tags associated with this object.
        Specified by:
        hasTags in interface Taggable
        See Also:
        Taggable.hasTags()
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String key)
        Description copied from interface: Addeable
        Returns the value for the given key.
        Specified by:
        getAttribute in interface Addeable
        Returns:
        the value for the given key or null if no value has been added for the key.
        See Also:
        Addeable.getAttribute(java.lang.String)
      • getAttributeKeys

        public java.util.List<java.lang.String> getAttributeKeys()
        Description copied from interface: Addeable
        Returns all keys that have been added to this object.
        Specified by:
        getAttributeKeys in interface Addeable
        Returns:
        a list of keys that have been added to this object.
        See Also:
        Addeable.getAttributeKeys()