|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.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
public abstract class Settlement
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 | |
|---|---|
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 java.util.List<Tile> |
ownedTiles
The tiles this settlement owns. |
protected Player |
owner
The Player owning this Settlement. |
protected Tile |
tile
The Tile where this Settlement is located. |
private SettlementType |
type
Describe type here. |
| Fields inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
UNITS_TAG_NAME |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
protected |
Settlement()
Empty constructor needed for Colony -> ServerColony. |
|
Settlement(Game game,
Player owner,
java.lang.String name,
Tile tile)
Creates a new Settlement. |
|
Settlement(Game game,
java.lang.String id)
Initiates a new Settlement
with the given ID. |
|
Settlement(Game game,
javax.xml.stream.XMLStreamReader in)
Initiates a new Settlement from an Element. |
| Method Summary | |
|---|---|
void |
addTile(Tile tile)
Adds a tile to this settlement. |
boolean |
canBuildEquipment(EquipmentType equipmentType)
Return true if this Colony could build at least one item of the given EquipmentType. |
boolean |
canProvideEquipment(EquipmentType equipmentType)
Determines if this settlement can build the given type of equipment. |
boolean |
canProvideEquipment(java.util.List<EquipmentType> equipment)
Return true if this Settlement could provide at least one item of all the given EquipmentTypes. |
void |
changeOwner(Player newOwner)
Change the owner of this Settlement. |
java.util.List<FreeColGameObject> |
disposeList()
Dispose of this settlement. |
int |
getConsumptionOf(GoodsType goodsType)
Returns the number of goods of a given type used by the settlement each turn. |
int |
getConsumptionOf(java.util.List<GoodsType> goodsTypes)
Returns the number of goods of all given types used by the settlement each turn. |
abstract Unit |
getDefendingUnit(Unit attacker)
Gets the Unit that is currently defending this
Settlement. |
FeatureContainer |
getFeatureContainer()
Describe getFeatureContainer method here. |
int |
getFoodConsumption()
Gives the food needed to keep all units alive in this Settlement. |
abstract java.lang.String |
getImageKey()
Gets an image key for this settlement. |
int |
getLineOfSight()
Gets this colony's line of sight. |
java.util.Set<Modifier> |
getModifierSet(java.lang.String key)
|
java.lang.String |
getName()
Gets the name of this Settlement. |
abstract java.lang.String |
getNameFor(Player player)
Gets the name of this Settlement for a particular player. |
java.lang.String |
getNameKey()
Gets the name of this Named. |
java.util.List<Tile> |
getOwnedTiles()
Get the tiles this settlement owns. |
Player |
getOwner()
Gets the owner of this Settlement. |
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. |
abstract int |
getProductionOf(GoodsType goodsType)
Returns the production of the given type of goods. |
int |
getRadius()
Gets the radius of what the Settlement considers
as it's own land. |
Settlement |
getSettlement()
Returns this Settlement. |
abstract int |
getSoL()
Gets the current Sons of Liberty in this settlement. |
Tile |
getTile()
Gets the Tile where this Settlement is located. |
SettlementType |
getType()
Get the Type value. |
boolean |
isCapital()
Returns true if this is the Nation's capital. |
boolean |
isConnected()
Returns whether this settlement is connected by water to Europe. |
void |
placeSettlement(boolean maximal)
Put a prepared settlement onto the map. |
abstract boolean |
propagateAlarm(Player player,
int addToAlarm)
Propagates a global change in tension down to a settlement. |
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
Reads the attributes of this object from an XML stream. |
void |
removeTile(Tile tile)
Removes a tile from this settlement. |
void |
setCapital(boolean isCapital)
Sets the capital value. |
protected void |
setFeatureContainer(FeatureContainer container)
Describe setFeatureContainer method here. |
void |
setName(java.lang.String newName)
Sets the name of this Settlement. |
void |
setOwner(Player player)
Sets the owner of this Settlement. |
void |
setType(SettlementType newType)
Set the Type value. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
Write the attributes of this object to a stream. |
| Methods inherited from class net.sf.freecol.common.model.GoodsLocation |
|---|
add, addGoods, addGoods, contains, dispose, getCompactGoods, getGoodsCapacity, getGoodsContainer, getGoodsCount, getGoodsIterator, getNoAddReason, getWarehouseCapacity, readChild, remove, removeGoods, removeGoods, removeGoods, setGoodsContainer, writeChildren |
| Methods inherited from class net.sf.freecol.common.model.UnitLocation |
|---|
canAdd, getColony, getLocationName, getLocationNameFor, getSpaceTaken, getUnitCapacity, getUnitCount, getUnitIterator, getUnitList, isEmpty, isFull, readChildren |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, getXMLElementTagName, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toString, toXML, toXMLImpl, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject |
| 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 |
|---|
private static final java.util.logging.Logger logger
public static final int FOOD_PER_COLONIST
protected Player owner
Player owning this Settlement.
private java.lang.String name
protected Tile tile
Tile where this Settlement is located.
private FeatureContainer featureContainer
private java.util.List<Tile> ownedTiles
private SettlementType type
| Constructor Detail |
|---|
protected Settlement()
public Settlement(Game game,
Player owner,
java.lang.String name,
Tile tile)
Settlement.
game - The Game in which this object belong.owner - The owner of this Settlement.name - The name for this Settlement.tile - The location of the Settlement.
public Settlement(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
Settlement from an Element.
game - The Game in which this object belong.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
public Settlement(Game game,
java.lang.String id)
Settlement
with the given ID. The object should later be
initialized by calling either
FreeColGameObject.readFromXML(XMLStreamReader) or
FreeColObject.readFromXMLElement(Element).
game - The Game in which this object belong.id - The unique identifier for this object.| Method Detail |
|---|
public final SettlementType getType()
Type value.
SettlementType valuepublic final void setType(SettlementType newType)
Type value.
newType - The new Type value.public java.util.Set<Modifier> getModifierSet(java.lang.String key)
public java.lang.String getNameKey()
NamedNamed.
getNameKey in interface NamedNamed.public java.lang.String getName()
Settlement.
String.public abstract java.lang.String getNameFor(Player player)
Settlement for a particular player.
player - A Player to return the name for.
String.public void setName(java.lang.String newName)
Settlement.
newName - The new name.public abstract java.lang.String getImageKey()
public boolean isCapital()
true if this is the Nation's capital.
true if this is the Nation's capital.public void setCapital(boolean isCapital)
isCapital - a boolean valuepublic FeatureContainer getFeatureContainer()
getFeatureContainer method here.
FeatureContainer valueprotected void setFeatureContainer(FeatureContainer container)
setFeatureContainer method here.
container - a FeatureContainer valuepublic int getLineOfSight()
Colony.Player.canSee(Tile)public abstract Unit getDefendingUnit(Unit attacker)
Unit that is currently defending this
Settlement.
attacker - The unit be attacking this Settlement.
Unit that has been chosen to defend
this Settlement.public abstract RandomRange getPlunderRange(Unit attacker)
attacker - The Unit that takes the settlement.
RandomRange encapsulating the range of plunder
available.
public int getPlunder(Unit attacker,
java.util.Random random)
attacker - The Unit that takes the settlement.random - A pseudo-random number source.
public Tile getTile()
Tile where this Settlement is located.
getTile in interface LocationgetTile in class UnitLocationTile where this Settlement is located.public Settlement getSettlement()
getSettlement in interface LocationgetSettlement in class UnitLocationpublic void placeSettlement(boolean maximal)
maximal - If true, also claim all the tiles possible.public Player getOwner()
Settlement.
getOwner in interface OwnableSettlement.setOwner(net.sf.freecol.common.model.Player)public void setOwner(Player player)
Settlement.
setOwner in interface Ownableplayer - The new owner of this Settlement.public void changeOwner(Player newOwner)
Settlement.
newOwner - The Player that shall own this
Settlement.getOwner()public java.util.List<Tile> getOwnedTiles()
public void addTile(Tile tile)
tile - The Tile to add.public void removeTile(Tile tile)
tile - The Tile to remove.public java.util.List<FreeColGameObject> disposeList()
disposeList in class GoodsLocationpublic int getRadius()
Settlement considers
as it's own land.
public boolean isConnected()
true if this Settlement is connected
to Europe.public abstract int getSoL()
public abstract boolean propagateAlarm(Player player,
int addToAlarm)
player - The Player towards whom the alarm is felt.addToAlarm - The amount to add to the current alarm level.
public abstract int getProductionOf(GoodsType goodsType)
goodsType - The type of goods to get the production for.
Settlementpublic int getConsumptionOf(GoodsType goodsType)
goodsType - a GoodsType value
int valuepublic int getConsumptionOf(java.util.List<GoodsType> goodsTypes)
goodsTypes - GoodsType values
int valuepublic int getFoodConsumption()
public boolean canBuildEquipment(EquipmentType equipmentType)
equipmentType - The EquipmentType to build.
public boolean canProvideEquipment(EquipmentType equipmentType)
equipmentType - an EquipmentType value
canBuildEquipment(EquipmentType equipmentType)public boolean canProvideEquipment(java.util.List<EquipmentType> equipment)
equipment - A list of EquipmentTypes to build.
protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class UnitLocationout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class FreeColObjectin - The XML input stream.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||