|
||||||||||
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.Settlement
public abstract class Settlement
The super class of all settlements on the map (that is colonies and indian settlements).
Nested Class Summary | |
---|---|
static class |
Settlement.SettlementType
|
Field Summary | |
---|---|
static int |
FOOD_CONSUMPTION
|
static int |
RADIUS
|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
Settlement(Game game,
org.w3c.dom.Element e)
Initiates a new Settlement from an Element . |
|
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 | |
---|---|
abstract void |
add(Locatable locatable)
Adds a Locatable to this Location. |
void |
addGoods(AbstractGoods goods)
|
void |
addGoods(GoodsType type,
int amount)
Describe addGoods method here. |
abstract boolean |
canAdd(Locatable locatable)
Checks whether or not the specified locatable may be added to this Location . |
boolean |
canBuildEquipment(EquipmentType equipmentType)
Return true if this Colony could build at least one item of the given EquipmentType. |
void |
claimTile(Tile tile)
Claim a single Tile for this Settlement. |
abstract boolean |
contains(Locatable locatable)
Checks if this Location contains the specified
Locatable . |
void |
dispose()
Dispose of this Settlement . |
java.util.List<Goods> |
getCompactGoods()
Gets an List with every Goods in this
Colony . |
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. |
int |
getFoodConsumptionByType(GoodsType type)
Gets food consumption by type |
int |
getFoodCount()
Returns the total amount of food present. |
GoodsContainer |
getGoodsContainer()
Gets the GoodsContainer this Location use
for storing it's goods. |
int |
getGoodsCount(GoodsType type)
Gets the amount of one type of Goods at this Settlement. |
java.util.Iterator<Goods> |
getGoodsIterator()
Gets an Iterator of every Goods in this
GoodsContainer . |
int |
getLineOfSight()
Gets this colony's line of sight. |
java.lang.String |
getName()
Gets the name of this Settlement . |
Player |
getOwner()
Gets the owner of this Settlement . |
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. |
Tile |
getTile()
Gets the Tile where this Settlement is located. |
Tile |
getTile(int x,
int y)
Gets a Tile from the neighbourhood of this
Colony . |
abstract int |
getUnitCount()
Returns the number of units in this settlement. |
boolean |
isCapital()
Returns true if this is the Nation's capital. |
abstract void |
newTurn()
|
void |
placeSettlement()
Put a prepared settlement onto the map. |
abstract void |
remove(Locatable locatable)
Removes a Locatable from this Location. |
void |
removeGoods(AbstractGoods goods)
Removes the given Goods from the Settlement. |
void |
removeGoods(GoodsType type)
Removes all Goods of the given type from the Settlement. |
void |
removeGoods(GoodsType type,
int amount)
Removes a specified amount of a type of Goods from this Settlement. |
void |
setCapital(boolean isCapital)
Sets the capital value. |
void |
setName(java.lang.String newName)
Sets the name of this Settlement . |
void |
setOwner(Player owner)
Sets the owner of this Settlement . |
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
---|
addToRemoveElement, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, getXMLElementTagName, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toString, toXML, updateFreeColGameObject, updateID |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.freecol.common.model.Location |
---|
getColony, getId, getUnitIterator, getUnitList |
Field Detail |
---|
public static final int RADIUS
public static final int FOOD_CONSUMPTION
Constructor Detail |
---|
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, org.w3c.dom.Element e)
Settlement
from an Element
.
game
- The Game
in which this object belong.e
- An XML-element that will be used to initialize
this object.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 java.lang.String getName()
Settlement
.
getName
in interface Named
String
.public void setName(java.lang.String newName)
Settlement
.
newName
- The new name.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
valuepublic int getLineOfSight()
Colony
.Player.canSee(Tile)
public abstract Unit getDefendingUnit(Unit attacker)
Unit
that is currently defending this Settlement
.
attacker
- The target that would be attacking this Settlement
.
Unit
that has been chosen to defend this Settlement
.public Tile getTile()
Tile
where this Settlement
is located.
getTile
in interface Location
Tile
where this Settlement
is located.public Tile getTile(int x, int y)
Tile
from the neighbourhood of this
Colony
.
x
- The x-coordinate of the Tile
.y
- The y-coordinate of the Tile
.
Tile
.public void claimTile(Tile tile)
Tile
for this Settlement.
tile
- a Tile
valuepublic void placeSettlement()
public Player getOwner()
Settlement
.
getOwner
in interface Ownable
Settlement
.setOwner(net.sf.freecol.common.model.Player)
public void setOwner(Player owner)
Settlement
.
setOwner
in interface Ownable
owner
- The Player
that shall own this Settlement
.getOwner()
public GoodsContainer getGoodsContainer()
Location
GoodsContainer
this Location
use
for storing it's goods.
getGoodsContainer
in interface Location
GoodsContainer
or null
if the
Location
cannot store any goods.public java.util.Iterator<Goods> getGoodsIterator()
Iterator
of every Goods
in this
GoodsContainer
. Each Goods
have a maximum
amount of 100.
Iterator
.public java.util.List<Goods> getCompactGoods()
List
with every Goods
in this
Colony
. There is only one Goods
for each
type of goods.
Iterator
.public abstract void add(Locatable locatable)
Locatable
to this Location.
add
in interface Location
locatable
- The Locatable
to add to this Location.public abstract void remove(Locatable locatable)
Locatable
from this Location.
remove
in interface Location
locatable
- The Locatable
to remove from this Location.public abstract boolean canAdd(Locatable locatable)
Location
Location
.
canAdd
in interface Location
locatable
- The Locatable
to add.
public abstract int getUnitCount()
getUnitCount
in interface Location
public abstract boolean contains(Locatable locatable)
Location
Location
contains the specified
Locatable
.
contains
in interface Location
locatable
- The Locatable
to test the presence of.
Locatable
is
on this Location
and
public void dispose()
Settlement
.
dispose
in class FreeColGameObject
public int getRadius()
Settlement
considers
as it's own land.
public abstract void newTurn()
public void removeGoods(GoodsType type, int amount)
type
- The type of Goods to remove from this settlement.amount
- The amount of Goods to remove from this settlement.public void removeGoods(AbstractGoods goods)
goods
- a Goods
valuepublic void removeGoods(GoodsType type)
type
- a GoodsType
valuepublic void addGoods(GoodsType type, int amount)
addGoods
method here.
type
- a GoodsType
valueamount
- an int
valuepublic void addGoods(AbstractGoods goods)
public int getGoodsCount(GoodsType type)
type
- The type of goods to look for.
public abstract int getProductionOf(GoodsType goodsType)
goodsType
- The type of goods to get the production for.
Settlement
public int getFoodConsumption()
public int getFoodConsumptionByType(GoodsType type)
public int getFoodCount()
int
valuepublic boolean canBuildEquipment(EquipmentType equipmentType)
equipmentType
- an EquipmentType
value
boolean
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |