Package net.sf.freecol.common.model
Class Settlement
- java.lang.Object
-
- net.sf.freecol.common.model.FreeColObject
-
- net.sf.freecol.common.model.FreeColGameObject
-
- net.sf.freecol.common.model.UnitLocation
-
- net.sf.freecol.common.model.GoodsLocation
-
- net.sf.freecol.common.model.Settlement
-
- All Implemented Interfaces:
java.lang.Comparable<FreeColObject>
,Location
,Nameable
,Ownable
,ObjectWithId
- Direct Known Subclasses:
Colony
,IndianSettlement
public abstract class Settlement extends GoodsLocation implements Nameable, Ownable
The super class of all settlements on the map (that is colonies and indian settlements).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.freecol.common.model.UnitLocation
UnitLocation.NoAddReason
-
-
Field Summary
Fields Modifier and Type Field Description private FeatureContainer
featureContainer
Contains the abilities and modifiers of this Settlement.static int
FOOD_PER_COLONIST
private static java.util.logging.Logger
logger
private java.lang.String
name
The name of the Settlement.private static java.lang.String
NAME_TAG
private java.util.Set<Tile>
ownedTiles
The tiles this settlement owns.protected Player
owner
ThePlayer
owning thisSettlement
.private static java.lang.String
OWNER_TAG
private static java.lang.String
SETTLEMENT_TYPE_TAG
protected Tile
tile
TheTile
where thisSettlement
is located.private static java.lang.String
TILE_TAG
private SettlementType
type
The type of settlement.-
Fields inherited from class net.sf.freecol.common.model.FreeColGameObject
initialized
-
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE_TAG, DEFAULT_CLASS_INDEX, fcoComparator, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE_TAG, VALUE_TAG
-
Fields inherited from interface net.sf.freecol.common.model.Location
LOCATION_RANK_EUROPE, LOCATION_RANK_HIGHSEAS, LOCATION_RANK_NOWHERE
-
-
Constructor Summary
Constructors Modifier Constructor Description Settlement(Game game, java.lang.String id)
Initiates a newSettlement
with the given identifier.protected
Settlement(Game game, Player owner, java.lang.String name, Tile tile)
Create a newSettlement
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addTile(Tile tile)
Adds a tile to this settlement.abstract int
calculateSettlementValue(int value, Unit unit)
Get the value of attacking aSettlement
boolean
canBombardEnemyShip()
Check if colony has the ability to bombard an enemy ship adjacent to it.Role
canImproveUnitMilitaryRole(Unit unit)
Can this settlement provide the goods to improve a given unit's role?protected boolean
canProvideGoods(java.util.List<AbstractGoods> goods)
Determines if this settlement can build the given type of equipment.void
changeOwner(Player newOwner)
Change the owner of thisSettlement
.private void
changeType(SettlementType newType)
Change the settlement type, setting the consequent features.Constants.IntegrityType
checkIntegrity(boolean fix, LogBuilder lb)
Checks the integrity of this game object.<T extends FreeColObject>
booleancopyIn(T other)
Copy another FreeColObject into this one if it is compatible.void
disposeResources()
Dispose of the resources of this object, and finally remove it from the game.boolean
equipForRole(Unit unit, Role role, int roleCount)
Equip a unit for a role using resources at this location.void
exciseSettlement()
Remove a settlement from the map.abstract StringTemplate
getAlarmLevelLabel(Player player)
Gets a label indicating the alarm level at this settlement with respect to another player.java.util.List<Unit>
getAllUnitsList()
Get all the units present here.protected int
getConsumptionOf(java.util.List<GoodsType> goodsTypes)
Returns the number of goods of all given types used by the settlement each turn.protected int
getConsumptionOf(GoodsType goodsType)
Returns the number of goods of a given type used by the settlement each turn.abstract double
getDefenceRatio()
Get the ratio between defence at this settlement, and the general settlement size.abstract Unit
getDefendingUnit(Unit attacker)
Gets theUnit
that is currently defending thisSettlement
.FeatureContainer
getFeatureContainer()
Gets the feature container for this object, if any.int
getFoodConsumption()
Gives the food needed to keep all units alive in this Settlement.int
getHighSeasCount()
Gets the minimum high seas count of the adjacent high-seas-connected tiles.int
getImmigration()
Gets the immigration points.int
getLiberty()
Gets the liberty points.int
getLineOfSight()
Gets this settlement's line of sight value.FreeColGameObject
getLinkTarget(Player player)
Get a suitable game object to use as a clickable link in messages to a player.java.lang.String
getLocationImageKey()
Get an image key for this location.StringTemplate
getLocationLabel()
Get a label for this location.java.lang.String
getName()
Get the name of thisSettlement
.UnitLocation.NoAddReason
getNoAddReason(Locatable locatable)
Gets the reason why a givenLocatable
can not be added to this Location.java.util.Set<Tile>
getOwnedTiles()
Get the tiles this settlement owns.Player
getOwner()
Gets the owner of thisOwnable
.int
getPlunder(Unit attacker, java.util.Random random)
Gets an amount of plunder when this settlement is taken.abstract RandomRange
getPlunderRange(Unit attacker)
Gets the range of gold plunderable when this settlement is captured.int
getRadius()
Gets the radius of what theSettlement
considers as it's own land.int
getRank()
Get a integer for this location, for the benefit of location comparators.Settlement
getSettlement()
Gets theSettlement
thisLocation
is located in.abstract int
getSoL()
Gets the current Sons of Liberty in this settlement.Tile
getTile()
Gets the Tile associated with this Location.abstract int
getTotalProductionOf(GoodsType goodsType)
Gets the total production of the given type of goods in this settlement.SettlementType
getType()
Get the type of this settlement.abstract int
getUpkeep()
Get the amount of gold necessary to maintain all of the settlement's buildings.java.util.Set<Tile>
getVisibleTileSet()
Get the tiles visible from this settlement.int
getWarehouseCapacity()
Gets the storage capacity of this settlement.abstract 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.abstract boolean
isBadlyDefended()
Is this settlement insufficiently defended?boolean
isCapital()
Is this a national capital?boolean
isConnectedPort()
Gets whether this settlement is connected to the high seas.boolean
isLandLocked()
Is this settlement landlocked?void
placeSettlement(boolean maximal)
Put a prepared settlement onto the map.int
priceGoods(java.util.List<AbstractGoods> goods)
What would the price be for a collection of goods at this location?protected void
readAttributes(FreeColXMLReader xr)
Reads the attributes of this object from an XML stream.protected void
readChild(FreeColXMLReader xr)
Reads a single child object.protected void
readChildren(FreeColXMLReader xr)
Reads the children of this object from an XML stream.void
removeTile(Tile tile)
Removes a tile from this settlement.void
setCapital(boolean capital)
void
setName(java.lang.String newName)
Sets the name of thisSettlement
.protected void
setOwnedTiles(java.util.Collection<Tile> ownedTiles)
Set the owned tiles set.void
setOwner(Player player)
Sets the owner of thisOwnable
.void
setType(SettlementType newType)
Set the settlement type.protected void
writeAttributes(FreeColXMLWriter xw)
Write the attributes of this object to a stream.protected void
writeChildren(FreeColXMLWriter xw)
Write the children of this object to a stream.-
Methods inherited from class net.sf.freecol.common.model.GoodsLocation
add, addGoods, addGoods, addGoods, contains, containsGoods, getCompactGoodsList, getDisposables, getGoodsCapacity, getGoodsContainer, getGoodsCount, getGoodsList, invalidateCache, moveGoods, remove, removeAll, removeGoods, removeGoods, removeGoods, setGoodsContainer
-
Methods inherited from class net.sf.freecol.common.model.UnitLocation
canAdd, clearUnitList, getCarrierForUnit, getColony, getFirstUnit, getIndianSettlement, getLastUnit, getLocationLabelFor, getNavalUnits, getSpaceTaken, getTotalUnitCount, getUnitCapacity, getUnitCount, getUnitList, getUnits, hasCarrierWithSpace, intern, isEmpty, isFull, moveToFront
-
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
dispose, equals, fundamentalDispose, getClassIndex, getGame, getSpecification, hashCode, internId, isDisposed, isInitialized, isInternable, readFromXML, setGame, setSpecification
-
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addAbility, addFeatures, addModifier, addPropertyChangeListener, addPropertyChangeListener, apply, apply, applyModifiers, applyModifiers, arrayKey, compareIds, compareTo, containsAbilityKey, containsModifierKey, copy, copy, copy, copy, copyInCast, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAbilities, getAbilities, getAbilities, getAbilities, getDefenceModifiers, getDisplayObject, getFreeColObjectClass, getFreeColObjectClassByName, getId, getIdNumber, getIdType, getIdTypeByName, getModifiers, getModifiers, getModifiers, getModifiers, getObjectClassIndex, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getSortedAbilities, getSortedModifiers, getSuffix, getSuffix, getXMLTagName, hasAbility, hasAbility, hasAbility, hasListeners, hasModifier, hasModifier, hasModifier, idEquals, invokeMethod, logFreeColObjects, readFromXMLPartial, removeAbilities, removeAbility, removeFeatures, removeModifier, removeModifiers, removePropertyChangeListener, removePropertyChangeListener, save, save, save, save, serialize, serialize, serialize, serialize, setId, toString, toXML, toXML, toXMLPartial, toXMLPartial
-
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, toShortString, up
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
FOOD_PER_COLONIST
public static final int FOOD_PER_COLONIST
- See Also:
- Constant Field Values
-
type
private SettlementType type
The type of settlement.
-
owner
protected Player owner
ThePlayer
owning thisSettlement
.
-
name
private java.lang.String name
The name of the Settlement.
-
tile
protected Tile tile
TheTile
where thisSettlement
is located.
-
ownedTiles
private final java.util.Set<Tile> ownedTiles
The tiles this settlement owns.
-
featureContainer
private final FeatureContainer featureContainer
Contains the abilities and modifiers of this Settlement.
-
NAME_TAG
private static final java.lang.String NAME_TAG
- See Also:
- Constant Field Values
-
OWNER_TAG
private static final java.lang.String OWNER_TAG
- See Also:
- Constant Field Values
-
SETTLEMENT_TYPE_TAG
private static final java.lang.String SETTLEMENT_TYPE_TAG
- See Also:
- Constant Field Values
-
TILE_TAG
private static final java.lang.String TILE_TAG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Settlement
protected Settlement(Game game, Player owner, java.lang.String name, Tile tile)
Create a newSettlement
.- Parameters:
game
- The enclosingGame
.owner
- The owningPlayer
.name
- The settlement name.tile
- The containingTile
.
-
Settlement
public Settlement(Game game, java.lang.String id)
Initiates a newSettlement
with the given identifier. The object should be initialized later.- Parameters:
game
- The enclosingGame
.id
- The object identifier.
-
-
Method Detail
-
getType
public final SettlementType getType()
Get the type of this settlement.- Returns:
- The settlement type.
-
setType
public void setType(SettlementType newType)
Set the settlement type.- Parameters:
newType
- The newSettlementType
.
-
getImmigration
public int getImmigration()
Gets the immigration points.- Returns:
- The current immigration.
-
getLiberty
public int getLiberty()
Gets the liberty points.- Returns:
- The current liberty.
-
isLandLocked
public boolean isLandLocked()
Is this settlement landlocked?- Returns:
- True if no adjacent tiles are water.
-
changeType
private final void changeType(SettlementType newType)
Change the settlement type, setting the consequent features.- Parameters:
newType
- The newSettlementType
.
-
isCapital
public boolean isCapital()
Is this a national capital?- Returns:
- True if this is a national capital.
-
setCapital
public void setCapital(boolean capital)
-
getOwnedTiles
public java.util.Set<Tile> getOwnedTiles()
Get the tiles this settlement owns.- Returns:
- A set of tiles.
-
setOwnedTiles
protected void setOwnedTiles(java.util.Collection<Tile> ownedTiles)
Set the owned tiles set.- Parameters:
ownedTiles
- The new set of ownedTile
s.
-
addTile
public void addTile(Tile tile)
Adds a tile to this settlement. We can not clear the settlement owned tiles container when the settlement is read because this is called when the Tile is read, and tiles can appear before and after the settlement in the map definition. So we just accumulate and defend against duplicates.- Parameters:
tile
- TheTile
to add.
-
removeTile
public void removeTile(Tile tile)
Removes a tile from this settlement.- Parameters:
tile
- TheTile
to remove.
-
getRadius
public int getRadius()
Gets the radius of what theSettlement
considers as it's own land.- Returns:
- Settlement radius
-
getLineOfSight
public int getLineOfSight()
Gets this settlement's line of sight value.- Returns:
- The line of sight value.
-
getPlunder
public int getPlunder(Unit attacker, java.util.Random random)
Gets an amount of plunder when this settlement is taken.- Parameters:
attacker
- TheUnit
that takes the settlement.random
- A pseudo-random number source.- Returns:
- An amount of gold plundered.
-
getVisibleTileSet
public java.util.Set<Tile> getVisibleTileSet()
Get the tiles visible from this settlement.- Returns:
- A set of visible tiles.
-
placeSettlement
public void placeSettlement(boolean maximal)
Put a prepared settlement onto the map. -vis: Several visibility issues accumulated here. -til: Several tile appearance issues accumulated here.- Parameters:
maximal
- If true, also claim all the tiles possible.
-
exciseSettlement
public void exciseSettlement()
Remove a settlement from the map. -vis: Visibility reduced when settlement goes away. -til: Several tile appearance issues accumulated here. Several visibility issues accumulated here.
-
changeOwner
public void changeOwner(Player newOwner)
Change the owner of thisSettlement
. Does not fix up the units! That is handled in the server. -vis: Changes visibility. -til: Changes tile appearance.- Parameters:
newOwner
- ThePlayer
that shall own thisSettlement
.- See Also:
getOwner()
-
isConnectedPort
public boolean isConnectedPort()
Gets whether this settlement is connected to the high seas. This is more than merely non-landlocked, because the settlement could be on an inland lake.- Returns:
- True if the settlement is connected to the high seas.
-
getHighSeasCount
public int getHighSeasCount()
Gets the minimum high seas count of the adjacent high-seas-connected tiles. This is a measure of how close this settlement is to Europe.- Returns:
- A high seas count, INFINITY if not connected.
-
getConsumptionOf
protected int getConsumptionOf(GoodsType goodsType)
Returns the number of goods of a given type used by the settlement each turn.- Parameters:
goodsType
- aGoodsType
value- Returns:
- an
int
value
-
getConsumptionOf
protected int getConsumptionOf(java.util.List<GoodsType> goodsTypes)
Returns the number of goods of all given types used by the settlement each turn.- Parameters:
goodsTypes
-GoodsType
values- Returns:
- an
int
value
-
getFoodConsumption
public int getFoodConsumption()
Gives the food needed to keep all units alive in this Settlement.- Returns:
- The amount of food eaten in this colony each this turn.
-
canProvideGoods
protected boolean canProvideGoods(java.util.List<AbstractGoods> goods)
Determines if this settlement can build the given type of equipment. Unlike priceGoods, this takes goods "reserved" for other purposes into account (e.g. breeding).- Parameters:
goods
- A list ofAbstractGoods
- Returns:
- True if the settlement can provide the equipment.
-
getWarehouseCapacity
public int getWarehouseCapacity()
Gets the storage capacity of this settlement.- Returns:
- The storage capacity of this settlement.
- See Also:
GoodsLocation.getGoodsCapacity()
-
canBombardEnemyShip
public boolean canBombardEnemyShip()
Check if colony has the ability to bombard an enemy ship adjacent to it. Only sea-side colonies can bombard. Does it have the buildings that give such abilities?- Returns:
- True if bombarding is allowed.
-
canImproveUnitMilitaryRole
public Role canImproveUnitMilitaryRole(Unit unit)
Can this settlement provide the goods to improve a given unit's role?- Parameters:
unit
- TheUnit
to check.- Returns:
- The
Role
that this settlement could provide.
-
getAllUnitsList
public java.util.List<Unit> getAllUnitsList()
Get all the units present here. That is, not just the units in the settlement but also the units on the tile.- Returns:
- A list of
Unit
s.
-
getLinkTarget
public FreeColGameObject getLinkTarget(Player player)
Get a suitable game object to use as a clickable link in messages to a player. Objects do not have links by default, hence the null return here. However, for example, a player's colony should return itself as a link target.- Overrides:
getLinkTarget
in classFreeColGameObject
- Parameters:
player
- ThePlayer
to make a link for.- Returns:
- A suitable link target if available, although usually null.
-
getFeatureContainer
public FeatureContainer getFeatureContainer()
Gets the feature container for this object, if any.- Overrides:
getFeatureContainer
in classFreeColObject
- Returns:
- The
FeatureContainer
for this object.
-
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 classUnitLocation
-
getName
public java.lang.String getName()
Get the name of thisSettlement
.
-
setName
public void setName(java.lang.String newName)
Sets the name of thisSettlement
. -til: Changes the tile appearance.
-
getOwner
public Player getOwner()
Gets the owner of thisOwnable
.
-
setOwner
public void setOwner(Player player)
Sets the owner of thisOwnable
. -vis: Changes visibility. -til: Changes tile appearance.
-
getTile
public final Tile getTile()
Gets the Tile associated with this Location.- Specified by:
getTile
in interfaceLocation
- Overrides:
getTile
in classUnitLocation
- Returns:
- The Tile associated with this Location, or null if none found.
-
getLocationLabel
public StringTemplate getLocationLabel()
Get a label for this location.- Specified by:
getLocationLabel
in interfaceLocation
- Overrides:
getLocationLabel
in classUnitLocation
- Returns:
- A label for this location.
-
getSettlement
public final Settlement getSettlement()
Gets theSettlement
thisLocation
is located in.- Specified by:
getSettlement
in interfaceLocation
- Overrides:
getSettlement
in classUnitLocation
- Returns:
- The associated
Settlement
, or null if none.
-
getRank
public final int getRank()
Get a integer for this location, for the benefit of location comparators.
-
getLocationImageKey
public java.lang.String getLocationImageKey()
Get an image key for this location.- Specified by:
getLocationImageKey
in interfaceLocation
- Returns:
- A key for image lookup, null by default.
-
getNoAddReason
public UnitLocation.NoAddReason getNoAddReason(Locatable locatable)
Gets the reason why a givenLocatable
can not be added to this Location. Be careful to test for unit presence last before success (NoAddReason.NONE) except perhaps for the capacity test, so that we can treat ALREADY_PRESENT as success in some cases (e.g. if the unit changes type --- does it still have a required skill?) FIXME: consider moving this up to Location?- Overrides:
getNoAddReason
in classGoodsLocation
- Parameters:
locatable
- TheLocatable
to test.- Returns:
- The reason why adding would fail.
-
priceGoods
public int priceGoods(java.util.List<AbstractGoods> goods) throws FreeColException
What would the price be for a collection of goods at this location?- Overrides:
priceGoods
in classUnitLocation
- Parameters:
goods
- The list ofAbstractGoods
to check for.- Returns:
- The net cost of acquiring the goods at this location.
- Throws:
FreeColException
- if the goods are unavailable for any reason.
-
equipForRole
public boolean equipForRole(Unit unit, Role role, int roleCount)
Equip a unit for a role using resources at this location.- Overrides:
equipForRole
in classUnitLocation
- Parameters:
unit
- TheUnit
to equip.role
- TheRole
to build for.roleCount
- The role count.- Returns:
- True if the equipping succeeded.
-
getDefendingUnit
public abstract Unit getDefendingUnit(Unit attacker)
Gets theUnit
that is currently defending thisSettlement
.- Parameters:
attacker
- TheUnit
that is attacking thisSettlement
.- Returns:
- The
Unit
that has been chosen to defend thisSettlement
.
-
getDefenceRatio
public abstract double getDefenceRatio()
Get the ratio between defence at this settlement, and the general settlement size.- Returns:
- A ratio of defence power to settlement size.
-
isBadlyDefended
public abstract boolean isBadlyDefended()
Is this settlement insufficiently defended?- Returns:
- True if this settlement needs more defence.
-
getPlunderRange
public abstract RandomRange getPlunderRange(Unit attacker)
Gets the range of gold plunderable when this settlement is captured.- Parameters:
attacker
- TheUnit
that takes the settlement.- Returns:
- A
RandomRange
encapsulating the range of plunder available.
-
getSoL
public abstract int getSoL()
Gets the current Sons of Liberty in this settlement.- Returns:
- The current SoL.
-
getUpkeep
public abstract int getUpkeep()
Get the amount of gold necessary to maintain all of the settlement's buildings.- Returns:
- The gold required for upkeep.
-
getTotalProductionOf
public abstract int getTotalProductionOf(GoodsType goodsType)
Gets the total production of the given type of goods in this settlement.- Parameters:
goodsType
- The type of goods to get the production for.- Returns:
- The total production of the given type of goods.
-
hasContacted
public abstract 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.- Parameters:
player
- The otherPlayer
to check.- Returns:
- True if the settlement has contacted the player.
-
getAlarmLevelLabel
public abstract StringTemplate getAlarmLevelLabel(Player player)
Gets a label indicating the alarm level at this settlement with respect to another player.- Parameters:
player
- The otherPlayer
.- Returns:
- A
StringTemplate
describing the alarm.
-
calculateSettlementValue
public abstract int calculateSettlementValue(int value, Unit unit)
Get the value of attacking aSettlement
- Parameters:
value
- The previously calculated input value from#scoreSettlementPath(AIUnit, PathNode, Settlement)
unit
- The Unit doing the attacking.- Returns:
- The calculated value
-
checkIntegrity
public Constants.IntegrityType checkIntegrity(boolean fix, LogBuilder lb)
Checks the integrity of this game object.- Overrides:
checkIntegrity
in classFreeColGameObject
- Parameters:
fix
- If true, fix problems if possible.lb
- ALogBuilder
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 classGoodsLocation
- Type Parameters:
T
- TheFreeColObject
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 classFreeColObject
- Parameters:
xw
- TheFreeColXMLWriter
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 classGoodsLocation
- Parameters:
xw
- TheFreeColXMLWriter
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 classFreeColGameObject
- Parameters:
xr
- TheFreeColXMLReader
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 classGoodsLocation
- Parameters:
xr
- TheFreeColXMLReader
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 classGoodsLocation
- Parameters:
xr
- TheFreeColXMLReader
to read from.- Throws:
javax.xml.stream.XMLStreamException
- if there is a problem reading the stream.
-
-