|
|||||||||
| 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
net.sf.freecol.common.model.Colony
public final class Colony
Represents a colony. A colony contains Buildings and
ColonyTiles. The latter represents the tiles around the
Colony where working is possible.
| Nested Class Summary | |
|---|---|
static class |
Colony.ColonyChangeEvent
|
static class |
Colony.NoBuildReason
|
private class |
Colony.Occupation
|
| Nested classes/interfaces inherited from class net.sf.freecol.common.model.Settlement |
|---|
Settlement.SettlementType |
| Field Summary | |
|---|---|
private java.util.Map<java.lang.String,Building> |
buildingMap
A map of Buildings, indexed by the ID of their basic type. |
private java.util.List<BuildableType> |
buildQueue
A list of Buildable items, which is NEVER empty. |
private java.util.List<ColonyTile> |
colonyTiles
A list of ColonyTiles. |
private java.util.Map<java.lang.String,ExportData> |
exportData
A map of ExportData, indexed by the IDs of GoodsTypes. |
static int |
FOOD_PER_COLONIST
|
static Ability |
HAS_PORT
|
private int |
immigration
The number of immigration points. |
private boolean |
landLocked
|
private int |
lastVisited
|
private int |
liberty
The number of liberty points. |
static int |
LIBERTY_PER_REBEL
|
private static java.util.logging.Logger |
logger
|
private int |
oldSonsOfLiberty
The SoL membership last turn. |
private int |
oldTories
The number of tories last turn. |
private int |
productionBonus
The current production bonus. |
static FreeColGameObjectType |
SOL_MODIFIER_SOURCE
|
private int |
sonsOfLiberty
The SoL membership this turn. |
private int |
tories
The number of tories this turn. |
private int |
unitCount
|
| 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 | |
|---|---|
Colony(Game game,
org.w3c.dom.Element e)
Initiates a new Colony from an XML representation. |
|
Colony(Game game,
Player owner,
java.lang.String name,
Tile tile)
Creates a new Colony. |
|
Colony(Game game,
java.lang.String id)
Initiates a new Colony with the given ID. |
|
Colony(Game game,
javax.xml.stream.XMLStreamReader in)
Initiates a new Colony from an XML representation. |
|
| Method Summary | |
|---|---|
void |
add(Locatable locatable)
Adds a Locatable to this Location. |
void |
addBuilding(Building building)
Add a Building to this Colony. |
private void |
addColonyTileProduction()
|
void |
addGoods(AbstractGoods goods)
|
void |
addGoods(GoodsType type,
int amount)
Describe addGoods method here. |
private void |
addInsufficientProductionMessage(java.util.List<java.lang.String> warnings,
Building building)
adds a message about insufficient production for a building |
void |
addLiberty(int amount)
Adds to the liberty points of the colony. |
int |
calculateMembership(int units)
Returns the SoL membership of the colony based on the liberty value and the number of colonists given. |
boolean |
canAdd(Locatable locatable)
Checks whether or not the specified locatable may be added to this Location. |
boolean |
canBombardEnemyShip()
Verify if colony has the conditions to bombard an enemy ship adjacent to it |
boolean |
canBreed(GoodsType goodsType)
Returns true if this Colony can breed the given
type of Goods. |
boolean |
canBuild()
Describe canBuild method here. |
boolean |
canBuild(BuildableType buildableType)
Returns true if this Colony can build the given BuildableType. |
boolean |
canPayToFinishBuilding()
Check if the owner can buy the remaining hammers and tools for the Building that is currently being built. |
boolean |
canPayToFinishBuilding(BuildableType buildableType)
Check if the owner can buy the remaining hammers and tools for the Building given. |
boolean |
canReducePopulation()
Returns true if the colony can reduce its population voluntarily. |
boolean |
canTrain(Unit unit)
Returns true if this colony has a schoolhouse and the unit type is a skilled unit type with a skill level not exceeding the level of the schoolhouse. |
boolean |
canTrain(UnitType unitType)
Returns true if this colony has a schoolhouse and the unit type is a skilled unit type with a skill level not exceeding the level of the schoolhouse. |
(package private) void |
checkBuildableComplete()
|
ModelMessage |
checkForGovMgtChangeMessage()
|
private void |
checkForNewColonist()
|
boolean |
contains(Locatable locatable)
Checks if this Location contains the specified
Locatable. |
Building |
createBuilding(BuildingType buildingType)
Ask the server to create a building for us. |
Building |
createFreeBuilding(BuildingType buildingType)
Ask the server to create a free building for us. |
private java.lang.String |
createInsufficientProductionMessage(GoodsType outputType,
int missingOutput,
GoodsType inputType,
int missingInput)
create a message about insufficient production |
private void |
createSoLMessages()
|
private void |
createWarehouseCapacityWarning()
|
void |
dispose()
Disposes this Colony. |
private void |
exportGoods()
|
Unit |
findTeacher(Unit unit)
|
java.util.List<UnitType> |
getBuildableUnits()
Returns a List with every unit type this colony may
build. |
Building |
getBuilding(BuildingType type)
Gets a Building of the specified type. |
Building |
getBuildingFor(Unit unit)
Return the Building best suited for the given Unit. |
Building |
getBuildingForConsuming(GoodsType goodsType)
Find a building for consuming the given type of goods. |
Building |
getBuildingForProducing(GoodsType goodsType)
Find a building for producing the given type of goods. |
java.util.List<Building> |
getBuildings()
Gets a List of every Building in this
Colony. |
java.util.List<Building> |
getBuildingsForConsuming(GoodsType goodsType)
Collect the buildings for consuming the given type of goods. |
java.util.List<Building> |
getBuildingsForProducing(GoodsType goodsType)
Collect the buildings for producing the given type of goods. |
Building |
getBuildingWithAbility(java.lang.String ability)
Returns a Building with the given
Ability, or null, if none exists. |
java.util.List<BuildableType> |
getBuildQueue()
Get the BuildQueue value. |
Colony |
getColony()
Returns just this Colony itself. |
ColonyTile |
getColonyTile(int x,
int y)
Gets the specified ColonyTile. |
ColonyTile |
getColonyTile(Tile t)
Returns the ColonyTile matching the given
Tile. |
java.util.List<ColonyTile> |
getColonyTiles()
Gets a List of every ColonyTile in this
Colony. |
int |
getConsumption(GoodsType goodsType)
Returns the number of goods of a given type used by the colony each turn. |
BuildableType |
getCurrentlyBuilding()
Returns the type of building currently being built. |
Unit |
getDefendingUnit(Unit attacker)
Gets the Unit that is currently defending this
Colony. |
ExportData |
getExportData(GoodsType goodsType)
Describe getExportData method here. |
FeatureContainer |
getFeatureContainer()
Describe getFeatureContainer method here. |
private Unit |
getFirstUnit()
|
int |
getFoodProduction()
Gets the combined production of all food types. |
int |
getImmigration()
Describe getImmigration method here. |
int |
getLiberty()
Describe getLiberty method here. |
int |
getMembers()
Return the number of sons of liberty |
java.util.Set<Modifier> |
getModifierSet(java.lang.String id)
Get the Modifier value. |
Colony.NoBuildReason |
getNoBuildReason(BuildableType buildableType)
Return the reason why the give BuildableType can
not be built. |
private Colony.Occupation |
getOccupationFor(Unit unit)
Returns an Occupation for the given Unit. |
int |
getPriceForBuilding()
Returns the price for the remaining hammers and tools for the Building that is currently being built. |
int |
getPriceForBuilding(BuildableType buildableType)
Returns the price for the remaining hammers and tools for the Building given. |
int |
getProductionBonus()
Returns the production bonus, if any, of the colony. |
Modifier |
getProductionModifier(GoodsType goodsType)
|
int |
getProductionNetOf(GoodsType goodsType)
Returns how much of a Good will be produced by this colony this turn, taking into account how much is consumed - by workers, horses, etc. |
int |
getProductionNextTurn(GoodsType goodsType)
Returns how much of a Good will be produced by this colony this turn |
int |
getProductionOf(GoodsType goodsType)
Returns the production of the given type of goods. |
Unit |
getRandomUnit()
Returns a random unit from this colony. |
int |
getSoL()
Returns the current SoL membership of the colony. |
Building |
getStockade()
Returns the stockade building |
java.util.List<Unit> |
getTeachers()
|
int |
getTory()
Returns the Tory membership of the colony. |
int |
getTurnsToComplete(BuildableType buildable)
Returns how many turns it would take to build the given BuildableType. |
int |
getUnitCount()
Gets 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. |
ColonyTile |
getVacantColonyTileFor(Unit unit,
boolean allowClaim,
GoodsType... goodsTypes)
Returns a vacant ColonyTile where the given
unit produces the maximum output of the given
goodsType. |
WorkLocation |
getVacantWorkLocationFor(Unit unit)
Gets a vacant WorkLocation for the given Unit. |
Building |
getWarehouse()
|
int |
getWarehouseCapacity()
Returns the capacity of this colony's warehouse. |
java.util.Collection<java.lang.String> |
getWarnings(GoodsType goodsType,
int amount,
int production)
determine if there is a problem with the production of the specified good |
java.util.List<WorkLocation> |
getWorkLocations()
Gets a List of every WorkLocation in this
Colony. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
int |
governmentChange(int units)
Returns 1, 0, or -1 to indicate that government would improve, remain the same, or deteriorate if the colony had the given population. |
boolean |
hasAbility(java.lang.String id)
Returns true if the Colony, or its owner has the ability identified by id. |
boolean |
hasAbility(java.lang.String id,
FreeColGameObjectType type)
Returns true if the Colony, or its owner has the ability identified by id. |
boolean |
hasStockade()
Returns true when colony has a stockade |
void |
incrementImmigration(int amount)
|
void |
incrementLiberty(int amount)
|
boolean |
isConnected()
Returns whether this colony is connected by water to Europe. |
private boolean |
isFree(BuildingType buildingType)
Returns true if a building of the given type can
be built for free. |
boolean |
isLandLocked()
Returns whether this colony is landlocked, or has access to water. |
boolean |
isUndead()
Returns whether this colony has undead units. |
private void |
modifySpecialGoods(GoodsType goodsType,
int amount)
|
void |
newTurn()
Prepares this Colony for a new turn. |
void |
payForBuilding()
Buys the remaining hammers and tools for the Building that is
currently being built. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
|
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. |
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. |
private void |
saveWarehouseState()
|
void |
setBuildQueue(java.util.List<BuildableType> newBuildQueue)
Set the BuildQueue value. |
void |
setCurrentlyBuilding(BuildableType buildable)
Sets the type of building to be built. |
void |
setExportData(ExportData newExportData)
Describe setExportData method here. |
void |
setOwner(Player owner)
Sets the owner of this Colony, including all units
within, and change main tile nation ownership. |
void |
setUnitCount(int unitCount)
Sets the number of units inside the colony, used in enemy colonies |
java.lang.String |
toString()
Gets a string representation of the Colony. |
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. |
(package private) void |
updateFood()
|
void |
updatePopulation(int difference)
Updates SoL and builds Buildings that are free if possible. |
private void |
updateProductionBonus()
|
void |
updateSoL()
Calculates the current SoL membership of the colony based on the liberty value and colonists. |
| Methods inherited from class net.sf.freecol.common.model.Settlement |
|---|
canBuildEquipment, claimTile, getCompactGoods, getFoodConsumption, getFoodConsumptionByType, getFoodCount, getGoodsContainer, getGoodsCount, getGoodsIterator, getLineOfSight, getName, getOwner, getRadius, getTile, getTile, isCapital, placeSettlement, removeFood, setCapital, setName |
| 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 java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.model.Nameable |
|---|
setName |
| Methods inherited from interface net.sf.freecol.common.model.Named |
|---|
getName |
| 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 LIBERTY_PER_REBEL
public static final int FOOD_PER_COLONIST
public static final Ability HAS_PORT
public static final FreeColGameObjectType SOL_MODIFIER_SOURCE
private final java.util.List<ColonyTile> colonyTiles
private final java.util.Map<java.lang.String,Building> buildingMap
private final java.util.Map<java.lang.String,ExportData> exportData
private int sonsOfLiberty
private int oldSonsOfLiberty
private int tories
private int oldTories
private int productionBonus
private int immigration
private int liberty
private boolean landLocked
private int unitCount
private int lastVisited
private java.util.List<BuildableType> buildQueue
| Constructor Detail |
|---|
public Colony(Game game,
Player owner,
java.lang.String name,
Tile tile)
Colony.
game - The Game in which this object belongs.owner - The Player owning this Colony.name - The name of the new Colony.tile - The location of the Colony.
public Colony(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
Colony from an XML representation.
game - The Game this object belongs to.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if an error occurred during parsing.
public Colony(Game game,
org.w3c.dom.Element e)
Colony from an XML representation.
game - The Game this object belongs to.e - An XML-element that will be used to initialize this object.
public Colony(Game game,
java.lang.String id)
Colony 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 |
|---|
private boolean isFree(BuildingType buildingType)
true if a building of the given type can
be built for free.
buildingType - a BuildingType value
boolean valuepublic void addBuilding(Building building)
building - a Building valuepublic boolean canReducePopulation()
boolean valuepublic void updatePopulation(int difference)
difference - an int valuepublic ExportData getExportData(GoodsType goodsType)
getExportData method here.
goodsType - a GoodsType value
ExportData valuepublic final void setExportData(ExportData newExportData)
setExportData method here.
newExportData - an ExportData valuepublic boolean isLandLocked()
true if there are no adjacent tiles to this
Colony's tile being water tiles.public boolean isConnected()
true if this Colony is connected
to Europe.public boolean isUndead()
public void setOwner(Player owner)
Colony, including all units
within, and change main tile nation ownership.
setOwner in interface OwnablesetOwner in class Settlementowner - The Player that shall own this
Settlement.Settlement.getOwner()public void setUnitCount(int unitCount)
unitCount - The units inside the colonygetUnitCount()public java.util.List<Building> getBuildingsForProducing(GoodsType goodsType)
goodsType - The type of goods.
List of Buildings which produce
the given type of goods.public java.util.List<Building> getBuildingsForConsuming(GoodsType goodsType)
goodsType - The type of goods.
List of Buildings which consume
the given type of goods.Goodspublic Building getBuildingForProducing(GoodsType goodsType)
goodsType - The type of goods.
Building which produces the given type of goods,
or null if such a building can not be found.public Building getBuildingForConsuming(GoodsType goodsType)
goodsType - The type of goods.
Building which consumes the given type of goods,
or null if such a building can not be found.public java.util.List<WorkLocation> getWorkLocations()
List of every WorkLocation in this
Colony.
List.WorkLocationpublic java.util.List<Building> getBuildings()
List of every Building in this
Colony.
List.Buildingpublic java.util.List<ColonyTile> getColonyTiles()
List of every ColonyTile in this
Colony.
List.ColonyTilepublic Building getBuilding(BuildingType type)
Building of the specified type.
type - The type of the building to get.
Building.public Building getBuildingWithAbility(java.lang.String ability)
Building with the given
Ability, or null, if none exists.
ability - a String value
Building value
public ColonyTile getColonyTile(int x,
int y)
ColonyTile.
x - The x-coordinate of the Tile.y - The y-coordinate of the Tile.
ColonyTile for the Tile
returned by Settlement.getTile(int, int).public ColonyTile getColonyTile(Tile t)
ColonyTile matching the given
Tile.
t - The Tile to get the ColonyTile
for.
ColonyTilepublic void incrementLiberty(int amount)
public void incrementImmigration(int amount)
public void add(Locatable locatable)
Locatable to this Location.
add in interface Locationadd in class Settlementlocatable - The Locatable to add to this Location.
public void removeGoods(GoodsType type,
int amount)
removeGoods in class Settlementtype - The type of Goods to remove from this settlement.amount - The amount of Goods to remove from this settlement.public void removeGoods(AbstractGoods goods)
removeGoods in class Settlementgoods - a Goods valuepublic void removeGoods(GoodsType type)
removeGoods in class Settlementtype - a GoodsType value
public void addGoods(GoodsType type,
int amount)
addGoods method here.
addGoods in class Settlementtype - a GoodsType valueamount - an int value
private void modifySpecialGoods(GoodsType goodsType,
int amount)
public void addGoods(AbstractGoods goods)
addGoods in class Settlementpublic void remove(Locatable locatable)
Locatable from this Location.
remove in interface Locationremove in class Settlementlocatable - The Locatable to remove from this
Location.public int getUnitCount()
WorkLocation in this Colony.
getUnitCount in interface LocationgetUnitCount in class Settlementpublic java.util.List<Unit> getUnitList()
Location
getUnitList in interface Locationpublic java.util.Iterator<Unit> getUnitIterator()
LocationIterator of every Unit directly
located on this Location.
getUnitIterator in interface LocationIterator.public boolean contains(Locatable locatable)
LocationLocation contains the specified
Locatable.
contains in interface Locationcontains in class Settlementlocatable - The Locatable to test the presence of.
Locatable is
on this Location and
public boolean canAdd(Locatable locatable)
LocationLocation.
canAdd in interface LocationcanAdd in class Settlementlocatable - The Locatable to add.
public boolean canTrain(Unit unit)
unit - The unit to add as a teacher.
true if this unit type could be added.public boolean canTrain(UnitType unitType)
unitType - The unit type to add as a teacher.
true if this unit type could be added.public java.util.List<Unit> getTeachers()
public Unit getDefendingUnit(Unit attacker)
Unit that is currently defending this
Colony.
Note that this function will only return a unit working inside the colony. Typically, colonies are also defended by units outside the colony on the same tile. To consider units outside the colony as well, use (@see Tile#getDefendingUnit) instead.
Returns an arbitrary unarmed land unit unless Paul Revere is present as founding father, in which case the unit can be armed as well.
getDefendingUnit in class Settlementattacker - The unit that would be attacking this colony.
Unit that has been chosen to defend this
colony, or null if the colony belongs to another
player and client is not permitted to view contents.
java.lang.IllegalStateException - if there are units in the colonyTile.getDefendingUnit(Unit)public java.util.List<UnitType> getBuildableUnits()
List with every unit type this colony may
build.
List with UnitTypepublic BuildableType getCurrentlyBuilding()
public void setCurrentlyBuilding(BuildableType buildable)
buildable - The type of building to be built.public int getTurnsToComplete(BuildableType buildable)
BuildableType. Returns a negative number if any of the production goods isnt
being built, Integer.MIN_VAL if none is, and there are no goods available
buildable - a BuildableType value
int valuepublic java.util.List<BuildableType> getBuildQueue()
BuildQueue value.
List valuepublic void setBuildQueue(java.util.List<BuildableType> newBuildQueue)
BuildQueue value.
newBuildQueue - The new BuildQueue value.public int getLiberty()
getLiberty method here.
int valuepublic void addLiberty(int amount)
amount - The number of liberty to add.public int getImmigration()
getImmigration method here.
int valuepublic int getConsumption(GoodsType goodsType)
goodsType - a GoodsType value
int valuepublic int getSoL()
public void updateSoL()
public int calculateMembership(int units)
units - an int value
int valuepublic int getMembers()
public int getTory()
public int getProductionBonus()
public Modifier getProductionModifier(GoodsType goodsType)
public java.lang.String toString()
Colony, but that may change
later.
toString in class FreeColGameObjectSettlement.getName()public int getFoodProduction()
int valuepublic int getProductionOf(GoodsType goodsType)
getProductionOf in class SettlementgoodsType - The type of goods to get the production for.
Colony's buildings and
tiles.public WorkLocation getVacantWorkLocationFor(Unit unit)
WorkLocation for the given Unit.
unit - The Unit
WorkLocation for the given
Unit or null if there is no such
location.private Colony.Occupation getOccupationFor(Unit unit)
Occupation for the given Unit.
unit - The Unit
Occupation for the given
Unit or null if there is none.public Building getBuildingFor(Unit unit)
unit - an Unit value
Building value
public ColonyTile getVacantColonyTileFor(Unit unit,
boolean allowClaim,
GoodsType... goodsTypes)
ColonyTile where the given
unit produces the maximum output of the given
goodsType.
unit - The Unit to find a vacant
ColonyTile for.allowClaim - Allow claiming free tiles from other settlements.goodsTypes - The types of goods that should be produced.
ColonyTile giving the highest production of
the given goods for the given unit or null if
there is no available ColonyTile for producing
that goods.public int getProductionNextTurn(GoodsType goodsType)
goodsType - The goods' type.
public int getProductionNetOf(GoodsType goodsType)
goodsType - The goods' type.
public boolean canBreed(GoodsType goodsType)
true if this Colony can breed the given
type of Goods. Only animals (such as horses) are expected to be
breedable.
goodsType - a GoodsType value
boolean valuepublic boolean canBuild()
canBuild method here.
boolean valuepublic boolean canBuild(BuildableType buildableType)
buildableType - a BuildableType value
boolean valuepublic Colony.NoBuildReason getNoBuildReason(BuildableType buildableType)
BuildableType can
not be built.
buildableType - a BuildableType value
NoBuildReason valuepublic Building createBuilding(BuildingType buildingType)
buildingType - a BuildingType value
Building valuepublic Building createFreeBuilding(BuildingType buildingType)
buildingType - a BuildingType value
Building valuevoid checkBuildableComplete()
public int getPriceForBuilding()
Building that is currently being built.
payForBuilding()public int getPriceForBuilding(BuildableType buildableType)
Building given.
buildableType - a BuildableType value
payForBuilding()public void payForBuilding()
Building that is
currently being built.
java.lang.IllegalStateException - If the owner of this Colony
has an insufficient amount of gold.getPriceForBuilding()public boolean canPayToFinishBuilding()
Building that is currently being built.
java.lang.IllegalStateException - If the owner of this Colony
has an insufficient amount of gold.getPriceForBuilding()public boolean canPayToFinishBuilding(BuildableType buildableType)
Building given.
buildableType - a BuildableType value
boolean value
java.lang.IllegalStateException - If the owner of this Colony
has an insufficient amount of gold.getPriceForBuilding()
public java.util.Collection<java.lang.String> getWarnings(GoodsType goodsType,
int amount,
int production)
goodsType - for this goodamount - warehouse amountproduction - production per turn
private void addInsufficientProductionMessage(java.util.List<java.lang.String> warnings,
Building building)
warnings - where to add the warningsbuilding - for this building
private java.lang.String createInsufficientProductionMessage(GoodsType outputType,
int missingOutput,
GoodsType inputType,
int missingInput)
outputType - output typemissingOutput - missing outputinputType - input typemissingInput - missing input
public Unit getRandomUnit()
Colony. This
Unit will either be working in a Building
or a ColonyTile.private Unit getFirstUnit()
private void saveWarehouseState()
private void addColonyTileProduction()
void updateFood()
private void checkForNewColonist()
private void exportGoods()
public Unit findTeacher(Unit unit)
private void createWarehouseCapacityWarning()
private void createSoLMessages()
public int governmentChange(int units)
units - an int value
int valuepublic ModelMessage checkForGovMgtChangeMessage()
private void updateProductionBonus()
public void newTurn()
Colony for a new turn.
newTurn in class Settlementpublic int getWarehouseCapacity()
Goods.FOOD, will be removed when calling
newTurn().
Colony's warehouse.public Building getWarehouse()
public void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange in interface java.beans.PropertyChangeListenerpublic void dispose()
Colony. All WorkLocations
owned by this Colony will also be destroyed.
dispose in class Settlement
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
Player will be added
to that representation if showAll is set to
false.
toXMLImpl in class FreeColGameObjectout - 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.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public static java.lang.String getXMLElementTagName()
public Colony getColony()
getColony in interface Locationpublic boolean hasStockade()
public Building getStockade()
Buildingpublic final java.util.Set<Modifier> getModifierSet(java.lang.String id)
Modifier value.
id - a String value
Modifier valuepublic boolean hasAbility(java.lang.String id)
id.
hasAbility in class FreeColObjectid - a String value
boolean value
public boolean hasAbility(java.lang.String id,
FreeColGameObjectType type)
id.
id - a String valuetype - a FreeColGameObjectType value
boolean valuepublic FeatureContainer getFeatureContainer()
SettlementgetFeatureContainer method here.
getFeatureContainer in class SettlementFeatureContainer valuepublic boolean canBombardEnemyShip()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||