Class Alliance


  • public class Alliance
    extends java.lang.Object
    A class representing an alliance status between two factions. The faction having this alliance is implicit, the target faction is an explicite field of this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      Alliance​(Faction faction)
      Create a new Alliance object for an alliance with the specified faction and without any alliance status set.
      Alliance​(Faction faction, int state)
      Create a new Alliance object for an alliance with the specified faction and the specified status.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addState​(int aState)
      Changes the state to include state.
      java.util.List<AllianceCategory> getAllianceCategories()
      Returns all alliance categories assigned to this alliance
      Faction getFaction()
      Returns the faction this alliance refers to.
      protected java.lang.String getOrderTranslation​(StringID orderId)  
      int getState()
      Get the state bit-field of this alliance.
      boolean getState​(int selector)
      Determine whether a specific state of this alliance is set.
      int getTrustLevel()
      A method to convert an alliance into a trustlevel.
      java.lang.String stateToString()
      Get a string representation of the alliance state.
      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

      • Alliance

        public Alliance​(Faction faction)
        Create a new Alliance object for an alliance with the specified faction and without any alliance status set.
        Parameters:
        faction - the faction to establish an alliance with.
      • Alliance

        public Alliance​(Faction faction,
                        int state)
        Create a new Alliance object for an alliance with the specified faction and the specified status.
        Parameters:
        faction - the faction to establish an alliance with
        state - the alliance status, must be one of constants SILVER, FIGHT, GIVE, GUARD, GUISE or ALL.
        Throws:
        java.lang.NullPointerException - if the faction parameter is null.
    • Method Detail

      • getFaction

        public Faction getFaction()
        Returns the faction this alliance refers to. The return value is never null.
        Returns:
        the faction of this alliance
      • getState

        public int getState()
        Get the state bit-field of this alliance.
        Returns:
        the state bitfield.
      • getState

        public boolean getState​(int selector)
        Determine whether a specific state of this alliance is set.
        Parameters:
        selector - specifying one of the constants in this class.
        Returns:
        true if specific state is set, false if not which state should be evaluated.
      • addState

        public void addState​(int aState)
        Changes the state to include state.
      • stateToString

        public java.lang.String stateToString()
        Get a string representation of the alliance state.
        Returns:
        the alliance state as string.
      • getOrderTranslation

        protected java.lang.String getOrderTranslation​(StringID orderId)
      • getAllianceCategories

        public java.util.List<AllianceCategory> getAllianceCategories()
        Returns all alliance categories assigned to this 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 uses when Magellan calculates trust levels on its own.
        Returns:
        the trustlevel of this alliance