Class AllianceGroup

  • All Implemented Interfaces:
    Unique

    public class AllianceGroup
    extends java.lang.Object
    implements Unique
    A class representing an alliance with several members.
    • Constructor Summary

      Constructors 
      Constructor Description
      AllianceGroup​(EntityID id)
      Create a new Alliance object.
      AllianceGroup​(EntityID id, java.lang.String name)
      Create a new Alliance object with name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFaction​(Faction faction)
      Adds a faction to the list of factions belonging to this alliance.
      java.util.Collection<ID> getFactions()
      Returns a list of all factions belonging to this alliance.
      EntityID getID()
      Returns the value of id.
      EntityID getLeader()
      Returns the alliance's leader.
      java.lang.String getName()
      Returns the alliance name.
      int getTrustLevel()
      A method to convert an alliance into a trustlevel.
      void setLeader​(EntityID leader)
      Sets the leader of the alliance.
      void setName​(java.lang.String name)
      Sets the alliance name.
      java.lang.String toString()
      Return a string representation of this alliance object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AllianceGroup

        public AllianceGroup​(EntityID id)
        Create a new Alliance object.
        Parameters:
        id - the ID of this alliance group
        Throws:
        java.lang.NullPointerException - if the id is null.
      • AllianceGroup

        public AllianceGroup​(EntityID id,
                             java.lang.String name)
        Create a new Alliance object with name.
        Parameters:
        id - the ID of this alliance group
        name - The alliance name
        Throws:
        java.lang.NullPointerException - if the id is null.
    • Method Detail

      • getID

        public EntityID getID()
        Returns the value of id.
        Specified by:
        getID in interface Unique
        Returns:
        Returns id.
      • getName

        public java.lang.String getName()
        Returns the alliance name.
      • setName

        public void setName​(java.lang.String name)
        Sets the alliance name.
      • getLeader

        public EntityID getLeader()
        Returns the alliance's leader.
      • setLeader

        public void setLeader​(EntityID leader)
        Sets the leader of the alliance.
      • toString

        public java.lang.String toString()
        Return a string representation of this alliance object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the alliance object as string.
      • getTrustLevel

        public int getTrustLevel()
        A method to convert an alliance into a trustlevel. This method should be used when Magellan calculates trust levels on its own.
        Returns:
        the trustlevel of this alliance
      • addFaction

        public void addFaction​(Faction faction)
        Adds a faction to the list of factions belonging to this alliance.
      • getFactions

        public java.util.Collection<ID> getFactions()
        Returns a list of all factions belonging to this alliance.