net.sf.freecol.common.model
Class IndianSettlement

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObject
          extended by net.sf.freecol.common.model.Settlement
              extended by net.sf.freecol.common.model.IndianSettlement
All Implemented Interfaces:
Location, Named, Ownable

public class IndianSettlement
extends Settlement

Represents an Indian settlement.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.freecol.common.model.Settlement
Settlement.SettlementType
 
Field Summary
private  java.util.Map<Player,Tension> alarm
          Stores the alarm levels.
static int ALARM_NEW_MISSIONARY
           
static int ALARM_RADIUS
           
static java.lang.String ALARM_TAG_NAME
           
static int ALARM_TILE_IN_USE
           
private  int convertProgress
          Used for monitoring the progress towards creating a convert.
private  java.util.Comparator<Goods> exportGoodsComparator
           
static java.lang.String IS_VISITED_TAG_NAME
           
static int KEEP_RAW_MATERIAL
          The amount of raw material that should be available before producing manufactured goods.
(package private)  int lastTribute
          The number of the turn during which the last tribute was paid.
private  UnitType learnableSkill
          This is the skill that can be learned by Europeans at this settlement.
private static java.util.logging.Logger logger
           
static int MAX_CONVERT_DISTANCE
           
static int MAX_HORSES_PER_TURN
           
private  Unit missionary
           
static java.lang.String MISSIONARY_TAG_NAME
           
static int MISSIONARY_TENSION
           
static java.lang.String OWNED_UNITS_TAG_NAME
           
private  java.util.ArrayList<Unit> ownedUnits
           
static int TURNS_PER_TRIBUTE
           
private  java.util.List<Unit> units
           
static java.lang.String UNITS_TAG_NAME
           
private  java.util.Set<Player> visitedBy
          A map that tells if a player has visited the settlement.
static java.lang.String WANTED_GOODS_TAG_NAME
           
private  GoodsType[] wantedGoods
           
private  java.util.Comparator<GoodsType> wantedGoodsComparator
           
 
Fields inherited from class net.sf.freecol.common.model.Settlement
featureContainer, FOOD_CONSUMPTION, goodsContainer, owner, RADIUS, tile
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE
 
Constructor Summary
IndianSettlement(Game game, org.w3c.dom.Element e)
          Initiates a new IndianSettlement from an Element.
IndianSettlement(Game game, Player player, Tile tile, java.lang.String name, boolean isCapital, UnitType learnableSkill, java.util.Set<Player> isVisited, Unit missionary)
          The constructor to use.
IndianSettlement(Game game, java.lang.String id)
          Initiates a new IndianSettlement with the given ID.
IndianSettlement(Game game, javax.xml.stream.XMLStreamReader in)
          Initiates a new IndianSettlement from an Element.
 
Method Summary
 void add(Locatable locatable)
          Adds a Locatable to this Location.
 void addOwnedUnit(Unit unit)
          Adds the given Unit to the list of units that belongs to this IndianSettlement.
 boolean allowContact(Unit unit)
          Is a unit permitted to contact with this settlement? The unit must be from a nation that has already contacted, or in the first instance must be arriving by land (apparently including ships in adjacent ports in Col1).
private  void breedHorses()
          If horses are available and enough food is produced, increase horses
 boolean canAdd(Locatable locatable)
          Checks whether or not the specified locatable may be added to this Location.
private  void checkForNewIndian()
           
 boolean checkForNewMissionaryConvert()
           
private  void consumeGoods(GoodsType type, int amount)
           
 boolean contains(Locatable locatable)
          Checks if this Location contains the specified Locatable.
 void createGoodsContainer()
          Creates the GoodsContainer.
 void dispose()
          Disposes this settlement and removes its claims to adjacent tiles.
 void equipBraves()
          Equips braves with horses and muskets.
 java.util.Map<Player,Tension> getAlarm()
          Returns the alarm Map.
 Tension getAlarm(Player player)
          Gets the alarm level towards the given player.
 java.lang.String getAlarmLevelMessage(Player player)
          Gets the ID of the alarm message associated with the alarm level of this player.
 int getBonusMultiplier()
          Get general bonus multiplier.
 Colony getColony()
          An Indian settlement is no colony.
 Unit getDefendingUnit(Unit attacker)
          Gets the Unit that is currently defending this IndianSettlement.
 Unit getFirstUnit()
           
 int getGeneratedUnitCount()
          Provide some variation in unit count for different types of IndianSettlement.
 Unit getLastUnit()
           
 UnitType getLearnableSkill()
          Returns the skill that can be learned at this settlement.
 int getMaximumProduction(GoodsType goodsType)
          Gets the maximum possible production of the given type of goods.
 Unit getMissionary()
          Returns the missionary from this settlement if there is one or null if there is none.
 java.util.Iterator<Unit> getOwnedUnitsIterator()
          Gets an iterator over all the units this IndianSettlement is owning.
 int getPrice(Goods goods)
          Gets the amount of gold this IndianSettlment is willing to pay for the given Goods.
 int getPrice(GoodsType type, int amount)
          Gets the amount of gold this IndianSettlment is willing to pay for the given Goods.
private  int getPriceAddition()
          Get the extra bonus if this is a LONGHOUSE, CITY or a capital.
 int getPriceToSell(Goods goods)
          Gets the amount of gold this IndianSettlment is willing to pay for the given Goods.
 int getPriceToSell(GoodsType type, int amount)
          Gets the amount of gold this IndianSettlment is willing to pay for the given Goods.
 int getProductionOf(GoodsType type)
          Returns the production of the given type of goods.
 java.lang.String getResponseToMissionaryAttempt(Tension.Level tension, java.lang.String success)
          Gets the response to an attempt to create a mission
 java.util.List<Goods> getSellGoods()
          Returns an array with goods to sell
 int getTribute(Player player)
          Returns the amount of gold this settlement pays as a tribute.
 Settlement.SettlementType getTypeOfSettlement()
          Gets the kind of Indian settlement.
 int getUnitCount()
          Returns the amount of Units at this Location.
 java.util.Iterator<Unit> getUnitIterator()
          Gets a Iterator of every Unit directly located on this Location.
 java.util.List<Unit> getUnitList()
          Returns a list containing all the Units present at this Location.
 GoodsType[] getWantedGoods()
           
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
private  boolean hasBeenContacted(Player player)
          Has this settlement been contacted by a player? Supposed to be true if a unit has arrived by land and done something in the village (speak to chief, learn skill, missionary, trade, etc).
 boolean hasBeenVisited()
          Returns true if a European player has visited this settlement to speak with the chief.
 boolean hasBeenVisited(Player player)
          Returns true if a the given player has visited this settlement to speak with the chief.
private  void increaseAlarm()
           
 void modifyAlarm(Player player, int addToAlarm)
          Modifies the alarm level towards the given player.
 void newTurn()
           
 void propagatedAlarm(Player player, int addToAlarm)
          Propagates the tension felt towards a given nation from the tribe down to each settlement that has already met that nation.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void remove(Locatable locatable)
          Removes a Locatable from this Location.
 boolean removeOwnedUnit(Unit unit)
          Removes the given Unit to the list of units that belongs to this IndianSettlement.
 void setAlarm(Player player, Tension newAlarm)
          Sets alarm towards the given player.
 void setLearnableSkill(UnitType skill)
          Sets the learnable skill for this Indian settlement.
 void setMissionary(Unit missionary)
          Sets the missionary for this settlement.
 void setVisited(Player player)
          Sets the visited status of this settlement to true, indicating that a European has had a chat with the chief.
 void setWantedGoods(int index, GoodsType type)
           
 java.lang.String toString()
          Returns a string representation of the object.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out, Player player, boolean showAll, boolean toSavedGame)
          This method writes an XML-representation of this object to the given stream.
 void tradeGoodsWithSetlement(IndianSettlement settlement)
          Allows spread of horses and arms between settlements
 void updateWantedGoods()
          Updates the variable wantedGoods.
 
Methods inherited from class net.sf.freecol.common.model.Settlement
addGoods, addGoods, canBuildEquipment, claimTile, getCompactGoods, getFeatureContainer, getFoodConsumption, getFoodConsumptionByType, getFoodCount, getGoodsContainer, getGoodsCount, getGoodsIterator, getLineOfSight, getName, getOwner, getRadius, getTile, getTile, isCapital, placeSettlement, removeFood, removeGoods, removeGoods, removeGoods, setCapital, setName, setOwner
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
addModelMessage, addModelMessage, addModelMessage, addToRemoveElement, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, readFromXMLPartialByClass, setFakeID, setGame, setId, toSavedXML, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject, updateID
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.model.Location
getId
 

Field Detail

logger

private static final java.util.logging.Logger logger

MISSIONARY_TENSION

public static final int MISSIONARY_TENSION
See Also:
Constant Field Values

MAX_CONVERT_DISTANCE

public static final int MAX_CONVERT_DISTANCE
See Also:
Constant Field Values

TURNS_PER_TRIBUTE

public static final int TURNS_PER_TRIBUTE
See Also:
Constant Field Values

ALARM_RADIUS

public static final int ALARM_RADIUS
See Also:
Constant Field Values

ALARM_TILE_IN_USE

public static final int ALARM_TILE_IN_USE
See Also:
Constant Field Values

ALARM_NEW_MISSIONARY

public static final int ALARM_NEW_MISSIONARY
See Also:
Constant Field Values

MAX_HORSES_PER_TURN

public static final int MAX_HORSES_PER_TURN
See Also:
Constant Field Values

UNITS_TAG_NAME

public static final java.lang.String UNITS_TAG_NAME
See Also:
Constant Field Values

OWNED_UNITS_TAG_NAME

public static final java.lang.String OWNED_UNITS_TAG_NAME
See Also:
Constant Field Values

IS_VISITED_TAG_NAME

public static final java.lang.String IS_VISITED_TAG_NAME
See Also:
Constant Field Values

ALARM_TAG_NAME

public static final java.lang.String ALARM_TAG_NAME
See Also:
Constant Field Values

MISSIONARY_TAG_NAME

public static final java.lang.String MISSIONARY_TAG_NAME
See Also:
Constant Field Values

WANTED_GOODS_TAG_NAME

public static final java.lang.String WANTED_GOODS_TAG_NAME
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

learnableSkill

private 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

private GoodsType[] wantedGoods

visitedBy

private java.util.Set<Player> visitedBy
A map that tells if a player has visited the settlement. At the client side, only the information regarding the player on that client should be included.


units

private java.util.List<Unit> units

ownedUnits

private java.util.ArrayList<Unit> ownedUnits

missionary

private Unit missionary

convertProgress

private int convertProgress
Used for monitoring the progress towards creating a convert.


lastTribute

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


alarm

private java.util.Map<Player,Tension> alarm
Stores the alarm levels. Only used by AI. 0-1000 with 1000 as the maximum alarm level.


wantedGoodsComparator

private final java.util.Comparator<GoodsType> wantedGoodsComparator

exportGoodsComparator

private final java.util.Comparator<Goods> exportGoodsComparator
Constructor Detail

IndianSettlement

public IndianSettlement(Game game,
                        Player player,
                        Tile tile,
                        java.lang.String name,
                        boolean isCapital,
                        UnitType learnableSkill,
                        java.util.Set<Player> isVisited,
                        Unit missionary)
The constructor to use.

Parameters:
game - The Game in which this object belong.
player - The Player owning this settlement.
name - The name for this settlement.
tile - The location of the IndianSettlement.
isCapital - True if settlement is tribe's capital
learnableSkill - The skill that can be learned by Europeans at this settlement.
isVisited - Indicates if any European scout has asked to speak with the chief.
missionary - The missionary in this settlement (or null).
Throws:
java.lang.IllegalArgumentException - if an invalid tribe or kind is given

IndianSettlement

public IndianSettlement(Game game,
                        javax.xml.stream.XMLStreamReader in)
                 throws javax.xml.stream.XMLStreamException
Initiates a new IndianSettlement from an Element.

Parameters:
game - The Game in which this object belong.
in - The input stream containing the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

IndianSettlement

public IndianSettlement(Game game,
                        org.w3c.dom.Element e)
Initiates a new IndianSettlement from an Element.

Parameters:
game - The Game in which this object belong.
e - An XML-element that will be used to initialize this object.

IndianSettlement

public IndianSettlement(Game game,
                        java.lang.String id)
Initiates a new IndianSettlement with the given ID. The object should later be initialized by calling either FreeColGameObject.readFromXML(XMLStreamReader) or FreeColObject.readFromXMLElement(Element).

Parameters:
game - The Game in which this object belong.
id - The unique identifier for this object.
Method Detail

getAlarm

public java.util.Map<Player,Tension> getAlarm()
Returns the alarm Map.

Returns:
the alarm Map.

getTribute

public int getTribute(Player player)
Returns the amount of gold this settlement pays as a tribute.

Parameters:
player - a Player value
Returns:
an int value

modifyAlarm

public void modifyAlarm(Player player,
                        int addToAlarm)
Modifies the alarm level towards the given player.

Parameters:
player - The Player.
addToAlarm - The amount to add to the current alarm level.

propagatedAlarm

public void propagatedAlarm(Player player,
                            int addToAlarm)
Propagates the tension felt towards a given nation from the tribe down to each settlement that has already met that nation.

Parameters:
player - The Player towards whom the alarm is felt.
addToAlarm - The amount to add to the current alarm level.

setAlarm

public void setAlarm(Player player,
                     Tension newAlarm)
Sets alarm towards the given player.

Parameters:
player - The Player.
newAlarm - The new alarm value.

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:
An object representing the alarm level.

getAlarmLevelMessage

public java.lang.String getAlarmLevelMessage(Player player)
Gets the ID of the alarm message associated with the alarm level of this player.

Parameters:
player - The other player.
Returns:
The ID of an alarm level message.

hasBeenVisited

public boolean hasBeenVisited()
Returns true if a European player has visited this settlement to speak with the chief.

Returns:
true if a European player has visited this settlement to speak with the chief.

hasBeenContacted

private boolean hasBeenContacted(Player player)
Has this settlement been contacted by a player? Supposed to be true if a unit has arrived by land and done something in the village (speak to chief, learn skill, missionary, trade, etc). Currently does not work correctly as contact is not tracked exactly, (it used to be deeply entwined with "visited" but that was a different bug) but we can exploit the "alarm" variable to do a mostly-correct job.

Parameters:
player - The Player to consider.
Returns:
True if the settlement has been contacted by the given player.

allowContact

public boolean allowContact(Unit unit)
Is a unit permitted to contact with this settlement? The unit must be from a nation that has already contacted, or in the first instance must be arriving by land (apparently including ships in adjacent ports in Col1).

Parameters:
unit - The Unit that proposes to contact this settlement.
Returns:
True if the settlement accepts such contact.

hasBeenVisited

public boolean hasBeenVisited(Player player)
Returns true if a the given player has visited this settlement to speak with the chief.

Parameters:
player - The player to check if has visited the settlement
Returns:
true If a European player has visited this settlement to speak with the chief.

setVisited

public void setVisited(Player player)
Sets the visited status of this settlement to true, indicating that a European has had a chat with the chief.

Parameters:
player - a Player value

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.

getOwnedUnitsIterator

public java.util.Iterator<Unit> getOwnedUnitsIterator()
Gets an iterator over all the units this IndianSettlement is owning.

Returns:
The Iterator.

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

getLearnableSkill

public UnitType getLearnableSkill()
Returns the skill that can be learned at this settlement.

Returns:
The skill that can be learned at this settlement.

getMissionary

public Unit getMissionary()
Returns the missionary from this settlement if there is one or null if there is none.

Returns:
The missionary from this settlement if there is one or null if there is none.

setMissionary

public void setMissionary(Unit missionary)
Sets the missionary for this settlement.

Parameters:
missionary - The missionary for this settlement.

getResponseToMissionaryAttempt

public java.lang.String getResponseToMissionaryAttempt(Tension.Level tension,
                                                       java.lang.String success)
Gets the response to an attempt to create a mission

Returns:
response

getWantedGoods

public GoodsType[] getWantedGoods()

setWantedGoods

public void setWantedGoods(int index,
                           GoodsType type)

setLearnableSkill

public void setLearnableSkill(UnitType skill)
Sets the learnable skill for this Indian settlement.

Parameters:
skill - The new learnable skill for this Indian settlement.

getTypeOfSettlement

public Settlement.SettlementType getTypeOfSettlement()
Gets the kind of Indian settlement.


add

public void add(Locatable locatable)
Adds a Locatable to this Location.

Specified by:
add in interface Location
Specified by:
add in class Settlement
Parameters:
locatable - The Locatable to add to this Location.

remove

public void remove(Locatable locatable)
Removes a Locatable from this Location.

Specified by:
remove in interface Location
Specified by:
remove in class Settlement
Parameters:
locatable - The Locatable to remove from this Location.

getUnitCount

public int getUnitCount()
Returns the amount of Units at this Location.

Specified by:
getUnitCount in interface Location
Specified by:
getUnitCount in class Settlement
Returns:
The amount of Units at this Location.

getUnitList

public java.util.List<Unit> getUnitList()
Description copied from interface: Location
Returns a list containing all the Units present at this Location.

Returns:
a list containing the Units present at this location.

getUnitIterator

public java.util.Iterator<Unit> getUnitIterator()
Description copied from interface: Location
Gets a Iterator of every Unit directly located on this Location.

Returns:
The Iterator.

getFirstUnit

public Unit getFirstUnit()

getLastUnit

public Unit getLastUnit()

getDefendingUnit

public Unit getDefendingUnit(Unit attacker)
Gets the Unit that is currently defending this IndianSettlement.

Specified by:
getDefendingUnit in class Settlement
Parameters:
attacker - The unit that would be attacking this IndianSettlement.
Returns:
The Unit that has been chosen to defend this IndianSettlement.

getPrice

public int getPrice(Goods 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.

Parameters:
goods - The Goods to price.
Returns:
The price.

getPrice

public int getPrice(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.

Parameters:
type - The type of Goods to price.
amount - The amount of Goods to price.
Returns:
The price.

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 variable wantedGoods.

It is only meaningful to call this method from the server, since the settlement's GoodsContainer is hidden from the clients.


getPriceAddition

private int getPriceAddition()
Get the extra bonus if this is a LONGHOUSE, CITY or a capital.


getBonusMultiplier

public int getBonusMultiplier()
Get general bonus multiplier. This is >1 if this is a LONGHOUSE, CITY or a capital.

Returns:
The bonus multiplier.

getGeneratedUnitCount

public int getGeneratedUnitCount()
Provide some variation in unit count for different types of IndianSettlement.

Returns:
The number of units to generate for this settlement.

contains

public boolean contains(Locatable locatable)
Description copied from interface: Location
Checks if this Location contains the specified Locatable.

Specified by:
contains in interface Location
Specified by:
contains in class Settlement
Parameters:
locatable - The Locatable to test the presence of.
Returns:
  • true if the specified Locatable is on this Location and
  • false otherwise.

canAdd

public boolean canAdd(Locatable locatable)
Description copied from interface: Location
Checks whether or not the specified locatable may be added to this Location.

Specified by:
canAdd in interface Location
Specified by:
canAdd in class Settlement
Parameters:
locatable - The Locatable to add.
Returns:
The result.

getProductionOf

public int getProductionOf(GoodsType type)
Description copied from class: Settlement
Returns the production of the given type of goods.

Specified by:
getProductionOf in class Settlement
Parameters:
type - The type of goods to get the production for.
Returns:
The production of the given type of goods the current turn by the Settlement

newTurn

public void newTurn()
Specified by:
newTurn in class Settlement

checkForNewMissionaryConvert

public boolean checkForNewMissionaryConvert()

checkForNewIndian

private void checkForNewIndian()

increaseAlarm

private void increaseAlarm()

consumeGoods

private void consumeGoods(GoodsType type,
                          int amount)

equipBraves

public void equipBraves()
Equips braves with horses and muskets. Keeps some for the settlement defense


dispose

public void dispose()
Disposes this settlement and removes its claims to adjacent tiles.

Overrides:
dispose in class Settlement

createGoodsContainer

public void createGoodsContainer()
Creates the GoodsContainer.

DO NOT USE OTHER THAN IN FreeColServer.loadGame(net.sf.freecol.common.io.FreeColSavegameFile): Only for compatibility when loading savegames with pre-0.0.3 protocols.


breedHorses

private void breedHorses()
If horses are available and enough food is produced, increase horses


toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
                         Player player,
                         boolean showAll,
                         boolean toSavedGame)
                  throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Only attributes visible to the given Player will be added to that representation if showAll is set to false.

Specified by:
toXMLImpl in class FreeColGameObject
Parameters:
out - The target stream.
player - The Player this XML-representation should be made for, or null if showAll == true.
showAll - Only attributes visible to player will be added to the representation if showAll is set to false.
toSavedGame - If true then information that is only needed when saving a game is added.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Overrides:
readFromXMLImpl in class FreeColObject
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
"indianSettlement".

getColony

public Colony getColony()
An Indian settlement is no colony.

Returns:
null

getSellGoods

public java.util.List<Goods> getSellGoods()
Returns an array with goods to sell


getPriceToSell

public int getPriceToSell(Goods 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.

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 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.

Parameters:
type - The type of Goods to price.
amount - The amount of Goods to price.
Returns:
The price.

toString

public java.lang.String toString()
Description copied from class: FreeColGameObject
Returns a string representation of the object.

Overrides:
toString in class FreeColGameObject
Returns:
The String

tradeGoodsWithSetlement

public void tradeGoodsWithSetlement(IndianSettlement settlement)
Allows spread of horses and arms between settlements

Parameters:
settlement -