Class IndianNationType

    • Field Detail

      • skills

        private java.util.List<RandomChoice<UnitType>> skills
        Stores the ids of the skills taught by this Nation.
      • regions

        private java.util.List<java.lang.String> regions
        Identifiers for the regions that can be settled by this Nation.
    • Constructor Detail

      • IndianNationType

        public IndianNationType​(java.lang.String id,
                                Specification specification)
        Create a new native nation type.
        Parameters:
        id - The object identifier.
        specification - The Specification to refer to.
    • Method Detail

      • isEuropean

        public boolean isEuropean()
        Is this a European nation type?
        Specified by:
        isEuropean in class NationType
        Returns:
        False.
      • isIndian

        public boolean isIndian()
        Is this a native nation type?
        Specified by:
        isIndian in class NationType
        Returns:
        True.
      • isREF

        public boolean isREF()
        Is this a REF nation type?
        Specified by:
        isREF in class NationType
        Returns:
        False.
      • getSettlementTypeKey

        public final java.lang.String getSettlementTypeKey​(boolean plural)
        Get a message id for the general type of settlements of this nation.
        Parameters:
        plural - Choose the plural form or not.
        Returns:
        A suitable message id.
      • getSkills

        public java.util.List<RandomChoice<UnitType>> getSkills()
        Gets a list of this Nation's skills.
        Returns:
        A list of national skills.
      • setSkills

        protected void setSkills​(java.util.List<RandomChoice<UnitType>> skills)
        Set the skills of this nation.
        Parameters:
        skills - The new skills list.
      • addSkill

        private void addSkill​(UnitType unitType,
                              int probability)
        Add a skill.
        Parameters:
        unitType - The UnitType skill taught.
        probability - The probability of the skill.
      • generateSkillsForTile

        public java.util.List<RandomChoice<UnitType>> generateSkillsForTile​(Tile tile)
        Generates choices for skill that could be taught from a settlement on a given Tile.
        Parameters:
        tile - The Tile where the settlement will be located.
        Returns:
        A random choice set of skills.
      • getRegions

        public java.util.List<java.lang.String> getRegions()
        Gets the list of regions in which this tribe may settle.
        Returns:
        A list of regions identifiers.
      • setRegions

        protected void setRegions​(java.util.List<java.lang.String> regions)
        Set the settleable regions list.
        Parameters:
        regions - The new list of region identifiers.
      • addRegion

        private void addRegion​(java.lang.String id)
        Add a region identifier.
        Parameters:
        id - The object identifier.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class NationType
        Type Parameters:
        T - The FreeColObject subclass of the object to copy in.
        Parameters:
        other - The other object.
        Returns:
        True if the copy in is succesful.
      • writeChildren

        protected void writeChildren​(FreeColXMLWriter xw)
                              throws javax.xml.stream.XMLStreamException
        Write the children of this object to a stream. To be overridden if required by any object that has children and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeChildren in class NationType
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • readChildren

        protected void readChildren​(FreeColXMLReader xr)
                             throws javax.xml.stream.XMLStreamException
        Reads the children of this object from an XML stream.
        Overrides:
        readChildren in class NationType
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
      • readChild

        protected void readChild​(FreeColXMLReader xr)
                          throws javax.xml.stream.XMLStreamException
        Reads a single child object. Subclasses must override to read their enclosed elements. This particular instance of the routine always throws XMLStreamException because we should never arrive here. However it is very useful to always call super.readChild() when an unexpected tag is encountered, as the exception thrown here provides some useful debugging context.
        Overrides:
        readChild in class NationType
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
      • getXMLTagName

        public java.lang.String getXMLTagName()
        Get the serialization tag for this object.
        Specified by:
        getXMLTagName in class FreeColObject
        Returns:
        The tag.