Class IndianSettlement

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • NATIVE_PRODUCTION_EFFICIENCY

        public static final double NATIVE_PRODUCTION_EFFICIENCY
        The production fudge factor.
        See Also:
        Constant Field Values
      • WANTED_GOODS_COUNT

        public static final int WANTED_GOODS_COUNT
        The maximum number of wanted goods.
        See Also:
        Constant Field Values
      • TALES_RADIUS

        public static final int TALES_RADIUS
        Radius of native tales map reveal.
        See Also:
        Constant Field Values
      • TRADE_MINIMUM_SIZE

        public static final int TRADE_MINIMUM_SIZE
        Do not sell less than this amount of goods.
        See Also:
        Constant Field Values
      • TRADE_MINIMUM_PRICE

        public static final int TRADE_MINIMUM_PRICE
        Do not buy goods when the price is this low.
        See Also:
        Constant Field Values
      • KEEP_RAW_MATERIAL

        public static final int KEEP_RAW_MATERIAL
        The amount of raw material that should be available before producing manufactured goods.
        See Also:
        Constant Field Values
      • GIFT_THRESHOLD

        public static final int GIFT_THRESHOLD
        Generate gifts from goods that exceed KEEP_RAW_MATERIAL + GIFT_THRESHOLD.
        See Also:
        Constant Field Values
      • GIFT_MINIMUM

        public static final int GIFT_MINIMUM
        The minimum gift amount.
        See Also:
        Constant Field Values
      • GIFT_MAXIMUM

        public static final int GIFT_MAXIMUM
        The maximum gift amount.
        See Also:
        Constant Field Values
      • learnableSkill

        protected UnitType learnableSkill
        This is the skill that can be learned by Europeans at this settlement. At the server side its value will be null when the skill has already been taught to a European. At the client side the value null is also possible in case the player hasn't checked out the settlement yet.
      • wantedGoods

        protected final java.util.List<GoodsType> wantedGoods
        The goods this settlement wants.
      • contactLevels

        protected final java.util.Map<Player,​IndianSettlement.ContactLevel> contactLevels
        A map that tells if a player has spoken to the chief of this settlement. At the client side, only the information regarding the player on that client should be included.
      • ownedUnits

        protected final java.util.List<Unit> ownedUnits
        Units that belong to this settlement.
      • missionary

        protected Unit missionary
        The missionary at this settlement.
      • convertProgress

        protected int convertProgress
        Used for monitoring the progress towards creating a convert.
      • lastTribute

        protected int lastTribute
        The number of the turn during which the last tribute was paid.
      • mostHated

        protected Player mostHated
        The most hated nation.
      • alarm

        protected final java.util.Map<Player,​Tension> alarm
        Stores the alarm levels. Only used by AI. "Alarm" means: Tension with respect to a player from an IndianSettlement. Alarm is overloaded with the concept of "contact". If a settlement has never been contacted by a player, alarm.get(player) will be null. Acts causing contact initialize this variable.
      • forSale

        private final java.util.List<Goods> forSale
        Cache of goods offered for sale. Do not serialize.
      • CONTACT_LEVEL_TAG

        private static final java.lang.String CONTACT_LEVEL_TAG
        See Also:
        Constant Field Values
      • CONVERT_PROGRESS_TAG

        private static final java.lang.String CONVERT_PROGRESS_TAG
        See Also:
        Constant Field Values
      • LAST_TRIBUTE_TAG

        private static final java.lang.String LAST_TRIBUTE_TAG
        See Also:
        Constant Field Values
      • LEARNABLE_SKILL_TAG

        public static final java.lang.String LEARNABLE_SKILL_TAG
        See Also:
        Constant Field Values
      • WANTED_GOODS_TAG

        public static final java.lang.String WANTED_GOODS_TAG
        See Also:
        Constant Field Values
    • Constructor Detail

      • IndianSettlement

        protected IndianSettlement​(Game game,
                                   Player owner,
                                   java.lang.String name,
                                   Tile tile)
        Constructor for ServerIndianSettlement.
        Parameters:
        game - The enclosing Game.
        owner - The Player owning this settlement.
        name - The name for this settlement.
        tile - The containing Tile.
      • IndianSettlement

        public IndianSettlement​(Game game,
                                java.lang.String id)
        Creates a new IndianSettlement with the given identifier. The object should later be initialized by calling either FreeColGameObject.readFromXML(FreeColXMLReader).
        Parameters:
        game - The Game in which this object belong.
        id - The object identifier.
    • Method Detail

      • emptyWantedGoods

        private static java.util.List<GoodsType> emptyWantedGoods()
        Create an empty wanted goods list.
        Returns:
        A list of null wanted goods.
      • getOwnedUnitList

        public java.util.List<Unit> getOwnedUnitList()
        Gets a list of the units native to this settlement.
        Returns:
        The list of units native to this settlement.
      • setOwnedUnitList

        protected void setOwnedUnitList​(java.util.List<Unit> ownedUnits)
        Set the owned units list.
        Parameters:
        ownedUnits - The new owned Unit list.
      • addOwnedUnit

        public void addOwnedUnit​(Unit unit)
        Adds the given Unit to the list of units that belongs to this IndianSettlement.
        Parameters:
        unit - The Unit to be added.
      • clearOwnedUnits

        private void clearOwnedUnits()
        Clear the owned units.
      • removeOwnedUnit

        public boolean removeOwnedUnit​(Unit unit)
        Removes the given Unit to the list of units that belongs to this IndianSettlement. Returns true if the Unit was removed.
        Parameters:
        unit - The Unit to be removed from the list of the units this IndianSettlement owns.
        Returns:
        a boolean value
      • getLastTribute

        public int getLastTribute()
        Get the year of the last tribute.
        Returns:
        The year of the last tribute.
      • setLastTribute

        public void setLastTribute​(int lastTribute)
        Set the year of the last tribute.
        Parameters:
        lastTribute - The new last tribute year.
      • getLearnableSkill

        public UnitType getLearnableSkill()
        Gets the skill that can be learned at this settlement.
        Returns:
        The skill that can be learned at this settlement.
      • setLearnableSkill

        public void setLearnableSkill​(UnitType skill)
        Sets the learnable skill for this Indian settlement.
        Parameters:
        skill - The new learnable skill for this Indian settlement.
      • getLearnableSkillLabel

        public StringTemplate getLearnableSkillLabel​(boolean visited)
        Get a label appropriate to the current learnable skill and whether the requestor has visited this settlement.
        Parameters:
        visited - The visiting status.
        Returns:
        A StringTemplate describing the perceived skill.
      • getMissionary

        public Unit getMissionary()
        Gets the missionary from this settlement.
        Returns:
        The missionary at this settlement, or null if there is none.
      • hasMissionary

        public boolean hasMissionary()
        Does this settlement have a missionary?
        Returns:
        True if there is a missionary at this settlement.
      • hasMissionary

        public boolean hasMissionary​(Player player)
        Does this settlement have a missionary from the given player?
        Parameters:
        player - The Player to test.
        Returns:
        True if there is a suitable missionary present.
      • setMissionary

        public void setMissionary​(Unit missionary)
        Sets the missionary for this settlement. -vis: This routine has visibility implications when enhanced missionaries are enabled. -til: This changes the tile appearance.
        Parameters:
        missionary - The missionary for this settlement.
      • getMissionaryLineOfSight

        public int getMissionaryLineOfSight()
        Get the line of sight used by a missionary at this settlement.
        Returns:
        The missionary line of sight.
      • getMissionaryVisibleTiles

        public java.util.List<Tile> getMissionaryVisibleTiles()
        Get a stream of tiles that should be visible to a missionary at this settlement.
        Returns:
        A list of Tiles.
      • getConvertProgress

        public int getConvertProgress()
        Gets the convert progress status for this settlement.
        Returns:
        The convert progress status.
      • setConvertProgress

        public void setConvertProgress​(int progress)
        Sets the convert progress status for this settlement.
        Parameters:
        progress - The new convert progress status.
      • validWantedGoodsIndex

        private boolean validWantedGoodsIndex​(int index)
        Is a given index with the range of normal wanted goods.
        Parameters:
        index - The index to test.
        Returns:
        True if the index is in range.
      • getWantedGoods

        public java.util.List<GoodsType> getWantedGoods()
        Gets the goods wanted by this settlement.
        Returns:
        The wanted goods list.
      • getWantedGoods

        public GoodsType getWantedGoods​(int index)
        Gets one of the goods wanted by this settlement.
        Parameters:
        index - Which of the goods to get.
        Returns:
        The wanted GoodsType or null if not present or the index is out of range.
      • setWantedGoods

        public void setWantedGoods​(java.util.List<GoodsType> wanted)
        Sets the goods wanted by this Settlement.
        Parameters:
        wanted - The new wanted GoodsType list.
      • setWantedGoods

        public void setWantedGoods​(int index,
                                   GoodsType type)
        Sets the goods wanted by this settlement.
        Parameters:
        index - Which of the (usually 3) goods to set.
        type - The GoodsType wanted.
      • getWantedGoodsCount

        public int getWantedGoodsCount()
        Get the number of wanted goods. If any members of the array are null, we assume that subsequent ones are too.
        Returns:
        The number of wanted goods.
      • getWantedGoodsLabel

        public java.util.List<StringTemplate> getWantedGoodsLabel​(int index,
                                                                  Player player)
        Get a label for one of the wanted goods.
        Parameters:
        index - The index into the wanted goods.
        player - The requesting Player.
        Returns:
        A list of a StringTemplate for the label, and optionally one for a tool tip.
      • getMostHated

        public Player getMostHated()
        Gets the most hated nation of this settlement.
        Returns:
        The most hated nation.
      • setMostHated

        public void setMostHated​(Player mostHated)
        Sets the most hated nation of this settlement. -til: Changes the tile appearance.
        Parameters:
        mostHated - The new most hated nation.
      • getMostHatedLabel

        public StringTemplate getMostHatedLabel​(boolean contacted)
        Get a template for the current most hated nation, depending whether the requestor has contacted this settlement.
        Parameters:
        contacted - The contact status.
        Returns:
        A StringTemplate describing the perceived most hated nation.
      • setContactLevels

        protected void setContactLevels​(java.util.Map<Player,​IndianSettlement.ContactLevel> contactLevels)
        Set the contact levels.
        Parameters:
        contactLevels - The new contact level map.
      • clearContactLevels

        private void clearContactLevels()
        Clear the contact levels.
      • getContactLevel

        public IndianSettlement.ContactLevel getContactLevel​(Player player)
        Gets the contact level between this settlement and a player.
        Parameters:
        player - The Player to check.
        Returns:
        The contact level.
      • setContactLevel

        private void setContactLevel​(Player player,
                                     IndianSettlement.ContactLevel level)
        Sets a contact level between this settlement and a player.
        Parameters:
        player - The contacted Player.
        level - The new ContactLevel.
      • setContacted

        public boolean setContacted​(Player player)
        Make contact with this settlement (if it has not been previously contacted). Initialize tension level to the general level with respect to the contacting player--- effectively the average reputation of this player with the overall tribe.
        Parameters:
        player - The Player making contact.
        Returns:
        True if this was indeed the first contact between settlement and player.
      • hasVisited

        public boolean hasVisited​(Player player)
        Has a player visited this settlement?
        Parameters:
        player - The Player to check.
        Returns:
        True if the player has contacted this settlement.
      • setVisited

        public boolean setVisited​(Player player)
        Sets the contact level of this settlement to indicate that a European player has visited the settlement.
        Parameters:
        player - The visiting Player.
        Returns:
        True if this was the first time the settlement was visited by the player.
      • hasScouted

        public boolean hasScouted​(Player player)
        Has a player has spoken with the chief of this settlement.
        Parameters:
        player - The Player to check.
        Returns:
        True if the player has visited this settlement to speak with the chief.
      • setScouted

        public boolean setScouted​(Player player)
        Sets the contact level of this settlement to indicate that a European player has had a chat with the chief.
        Parameters:
        player - The visiting Player.
        Returns:
        True if this was the first time the settlement was scouted by the player.
      • hasAnyScouted

        public boolean hasAnyScouted()
        Has any European player spoken with the chief of this settlement.
        Returns:
        True if any European player has spoken with the chief.
      • worthScouting

        public boolean worthScouting​(Player player)
        Is this settlement worth scouting? That is, has it been contacted, but not scouted already, or visited when the "Chief contact" option is set.
        Parameters:
        player - The Player contemplating scouting.
        Returns:
        Whether it might be worth the player scouting this settlement.
      • getAlarm

        protected java.util.Map<Player,​Tension> getAlarm()
        Get the alarm map.
        Returns:
        The map of player to tension.
      • setAlarm

        protected void setAlarm​(java.util.Map<Player,​Tension> alarm)
        Set the alarm map.
        Parameters:
        alarm - The new map of Player to Tension.
      • getAlarm

        public Tension getAlarm​(Player player)
        Gets the alarm level towards the given player.
        Parameters:
        player - The Player to get the alarm level for.
        Returns:
        The current alarm level or null if the settlement has not encoutered the player.
      • setAlarm

        public void setAlarm​(Player player,
                             Tension newAlarm)
        Sets alarm towards the given player. -til: Might change tile appearance through most hated state
        Parameters:
        player - The Player to set the alarm level for.
        newAlarm - The new alarm value.
      • clearAlarm

        private void clearAlarm()
        Clear the alarm levels.
      • initializeAlarm

        protected void initializeAlarm​(Player player)
        Initialize the alarm at this settlement with respect to a player with the current national tension.
        Parameters:
        player - The Player to set the alarm level for.
      • getAlarmLevelKey

        public java.lang.String getAlarmLevelKey​(Player player)
        Gets a message key for a short alarm message associated with the alarm level of this player.
        Parameters:
        player - The other Player.
        Returns:
        The alarm message key.
      • getGoodsForSale

        public java.util.List<Goods> getGoodsForSale()
        Get the current goods offered for sale.
        Returns:
        A list of Goods for sale.
      • setGoodsForSale

        public void setGoodsForSale​(java.util.List<Goods> forSale)
        Set the current goods offered for sale.
        Parameters:
        forSale - A new list of Goods for sale.
      • allowContact

        public boolean allowContact​(Unit unit)
        Is a unit permitted to make contact with this settlement? The unit must be from a nation that has already made contact, or in the first instance, must be arriving by land, with the exception of trading ships.
        Parameters:
        unit - The Unit that proposes to contact this settlement.
        Returns:
        True if the settlement accepts such contact.
      • getPriceToBuy

        public <T extends AbstractGoods> int getPriceToBuy​(T goods)
        Gets the amount of gold this IndianSettlment is willing to pay for the given Goods. It is only meaningful to call this method from the server, since the settlement's GoodsContainer is hidden from the clients.
        Type Parameters:
        T - The base type of the goods.
        Parameters:
        goods - The goods to price.
        Returns:
        The price.
      • getPriceToBuy

        public int getPriceToBuy​(GoodsType type,
                                 int amount)
        Gets the amount of gold this IndianSettlment is willing to pay for the given Goods. It is only meaningful to call this method from the server, since the settlement's GoodsContainer is hidden from the clients. The AI uses it though so it stays here for now. Note that it takes no account of whether the native player actually has the gold. FIXME: this is rancid with magic numbers.
        Parameters:
        type - The type of Goods to price.
        amount - The amount of Goods to price.
        Returns:
        The price.
      • getNormalGoodsPriceToBuy

        private int getNormalGoodsPriceToBuy​(GoodsType type,
                                             int amount)
        Price some goods according to the amount present in the settlement.
        Parameters:
        type - The type of goods for sale.
        amount - The amount of goods for sale.
        Returns:
        A price for the goods.
      • getWantedGoodsAmount

        protected int getWantedGoodsAmount​(GoodsType type)
        Calculates how much of the given goods type this settlement wants and should retain.
        Parameters:
        type - The GoodsType.
        Returns:
        The amount of goods wanted.
      • getMilitaryGoodsPriceToBuy

        private int getMilitaryGoodsPriceToBuy​(GoodsType type,
                                               int amount)
        Price some goods that have military value to the settlement.
        Parameters:
        type - The type of goods for sale.
        amount - The amount of goods for sale.
        Returns:
        A price for the goods.
      • getPriceToSell

        public <T extends AbstractGoods> int getPriceToSell​(T goods)
        Gets the amount of gold this IndianSettlment is willing to sell the given Goods for. It is only meaningful to call this method from the server, since the settlement's GoodsContainer is hidden from the clients.
        Type Parameters:
        T - The base type of the goods.
        Parameters:
        goods - The goods to price.
        Returns:
        The price.
      • getPriceToSell

        public int getPriceToSell​(GoodsType type,
                                  int amount)
        Gets the amount of gold this IndianSettlment is willing to sell the given Goods for. It is only meaningful to call this method from the server, since the settlement's GoodsContainer is hidden from the clients.
        Parameters:
        type - The type of Goods to price.
        amount - The amount of Goods to price.
        Returns:
        The price.
      • willSell

        public boolean willSell​(GoodsType type)
        Will this settlement sell a type of goods. Placeholder until we have a spec-configured blacklist.
        Parameters:
        type - The GoodsType to consider.
        Returns:
        True if the settlement would sell the goods.
      • getSellGoods

        public java.util.List<Goods> getSellGoods​(Unit unit)
        Gets the goods this settlement is willing to sell. Sell new world goods first, then by decreasing price, then decreasing amount.
        Parameters:
        unit - An optional Unit that is trading.
        Returns:
        A list of goods to sell.
      • tradeGoodsWithSettlement

        public void tradeGoodsWithSettlement​(IndianSettlement is)
        Allows spread of horses and arms between settlements
        Parameters:
        is - The other IndianSettlement to trade with.
      • getMaximumProduction

        public int getMaximumProduction​(GoodsType goodsType)
        Gets the maximum possible production of the given type of goods.
        Parameters:
        goodsType - The type of goods to check.
        Returns:
        The maximum amount, of the given type of goods, that can be produced in one turn.
      • updateWantedGoods

        public void updateWantedGoods()
        Updates the goods wanted by this settlement. It is only meaningful to call this method from the server, since the settlement's GoodsContainer is hidden from the clients.
      • goodsToMake

        private GoodsType goodsToMake()
        Chooses a type of goods for some of the natives in a settlement to manufacture. Simple rule: choose the refined goods that is the greatest shortage for which there is a surplus of the raw material.
        Returns:
        A GoodsType to manufacture, or null if none suitable.
      • getRandomGift

        public Goods getRandomGift​(java.util.Random random)
        Gets a random goods gift from this settlement.
        Parameters:
        random - A pseudo random number source.
        Returns:
        A random goods gift, or null if none found.
      • addRandomGoods

        public void addRandomGoods​(java.util.Random random)
        Add some initial goods to a newly generated settlement. After all, they have been here for some time.
        Parameters:
        random - A pseudo-random number source.
      • getRequiredDefenders

        public int getRequiredDefenders()
        Get the number of braves expected to be present for the settlement not to be "badly defended".
        Returns:
        The required defender number.
      • disposeResources

        public void disposeResources()
        Dispose of the resources of this object, and finally remove it from the game. To be extended by subclasses, but they must tail call up towards this. -vis: Visibility changes when the settlement is removed.
        Overrides:
        disposeResources in class Settlement
      • add

        public boolean add​(Locatable locatable)
        Adds a Locatable to this Location.
        Specified by:
        add in interface Location
        Overrides:
        add in class GoodsLocation
        Parameters:
        locatable - The Locatable to add to this Location.
        Returns:
        True if the locatable was added.
      • up

        public Location up()
        Promote this location to a more meaningful one if possible. For example: a settlement is more meaningful than the tile it occupies.
        Specified by:
        up in interface Location
        Returns:
        A more meaningful Location, or this one.
      • toShortString

        public java.lang.String toShortString()
        Get a short description of this location.
        Specified by:
        toShortString in interface Location
        Returns:
        A short description.
      • invalidateCache

        public void invalidateCache()
        Invalidate any cache dependent on the goods levels.
        Specified by:
        invalidateCache in class GoodsLocation
      • getGoodsCapacity

        public int getGoodsCapacity()
        Gets the maximum number of Goods this Location can hold.
        Specified by:
        getGoodsCapacity in class GoodsLocation
        Returns:
        The capacity for goods
      • getDefendingUnit

        public Unit getDefendingUnit​(Unit attacker)
        Gets the Unit that is currently defending this Settlement.
        Specified by:
        getDefendingUnit in class Settlement
        Parameters:
        attacker - The Unit that is attacking this Settlement.
        Returns:
        The Unit that has been chosen to defend this Settlement.
      • getDefenceRatio

        public double getDefenceRatio()
        Get the ratio between defence at this settlement, and the general settlement size.
        Specified by:
        getDefenceRatio in class Settlement
        Returns:
        A ratio of defence power to settlement size.
      • isBadlyDefended

        public boolean isBadlyDefended()
        Is this settlement insufficiently defended?
        Specified by:
        isBadlyDefended in class Settlement
        Returns:
        True if this settlement needs more defence.
      • getPlunderRange

        public RandomRange getPlunderRange​(Unit attacker)
        Gets the range of gold plunderable when this settlement is captured.
        Specified by:
        getPlunderRange in class Settlement
        Parameters:
        attacker - The Unit that takes the settlement.
        Returns:
        A RandomRange encapsulating the range of plunder available.
      • getSoL

        public int getSoL()
        Gets the current Sons of Liberty in this settlement.
        Specified by:
        getSoL in class Settlement
        Returns:
        The current SoL.
      • getUpkeep

        public int getUpkeep()
        Get the amount of gold necessary to maintain all of the settlement's buildings.
        Specified by:
        getUpkeep in class Settlement
        Returns:
        The gold required for upkeep.
      • getTotalProductionOf

        public int getTotalProductionOf​(GoodsType type)
        Gets the total production of the given type of goods in this settlement.
        Specified by:
        getTotalProductionOf in class Settlement
        Parameters:
        type - The type of goods to get the production for.
        Returns:
        The total production of the given type of goods.
      • hasContacted

        public boolean hasContacted​(Player player)
        Has this settlement contacted a given player? Allow player == null as this is true in the map editor where the user player is moot.
        Specified by:
        hasContacted in class Settlement
        Parameters:
        player - The other Player to check.
        Returns:
        True if the settlement has contacted the player.
      • getAlarmLevelLabel

        public StringTemplate getAlarmLevelLabel​(Player player)
        Gets a label indicating the alarm level at this settlement with respect to another player.
        Specified by:
        getAlarmLevelLabel in class Settlement
        Parameters:
        player - The other Player.
        Returns:
        A StringTemplate describing the alarm.
      • getAvailableGoodsCount

        public int getAvailableGoodsCount​(GoodsType goodsType)
        Get the amount of a given goods type at this trade location.
        Specified by:
        getAvailableGoodsCount in interface TradeLocation
        Parameters:
        goodsType - The GoodsType to check.
        Returns:
        The amount of goods present.
      • getExportAmount

        public int getExportAmount​(GoodsType goodsType,
                                   int turns)
        Gets the amount of a given goods type that can be exported from this trade location after a given number of turns.
        Specified by:
        getExportAmount in interface TradeLocation
        Parameters:
        goodsType - The GoodsType to check.
        turns - The number of turns before the goods is required.
        Returns:
        The amount of goods to export.
      • getImportAmount

        public int getImportAmount​(GoodsType goodsType,
                                   int turns)
        Gets the amount of a given goods type that can be imported to this trade location after a given number of turns.
        Specified by:
        getImportAmount in interface TradeLocation
        Parameters:
        goodsType - The GoodsType to check.
        turns - The number of turns before the goods will arrive.
        Returns:
        The amount of goods to import.
      • getLocationName

        public java.lang.String getLocationName​(TradeLocation tradeLocation)
        Function for returning the name of a TradeLocation
        Specified by:
        getLocationName in interface TradeLocation
        Parameters:
        tradeLocation - The TradeLocation to return the name.
        Returns:
        The name.
      • checkIntegrity

        public Constants.IntegrityType checkIntegrity​(boolean fix,
                                                      LogBuilder lb)
        Checks the integrity of this game object.
        Overrides:
        checkIntegrity in class Settlement
        Parameters:
        fix - If true, fix problems if possible.
        lb - A LogBuilder to log to.
        Returns:
        A suitable IntegrityType.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class Settlement
        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.
      • writeAttributes

        protected void writeAttributes​(FreeColXMLWriter xw)
                                throws javax.xml.stream.XMLStreamException
        Write the attributes of this object to a stream. To be overridden if required by any object that has attributes and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeAttributes in class Settlement
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • 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 Settlement
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • readAttributes

        protected void readAttributes​(FreeColXMLReader xr)
                               throws javax.xml.stream.XMLStreamException
        Reads the attributes of this object from an XML stream.
        Overrides:
        readAttributes in class Settlement
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading 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 Settlement
        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 Settlement
        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.