net.sf.freecol.common.model
Class Colony

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.UnitLocation
              extended by net.sf.freecol.common.model.GoodsLocation
                  extended by net.sf.freecol.common.model.Settlement
                      extended by net.sf.freecol.common.model.Colony
All Implemented Interfaces:
Location, Nameable, Named, Ownable
Direct Known Subclasses:
ServerColony

public class Colony
extends Settlement
implements Nameable

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.UnitLocation
UnitLocation.NoAddReason
 
Field Summary
static java.lang.String BUILD_QUEUE_TAG
           
protected  java.util.Map<java.lang.String,Building> buildingMap
          A map of Buildings, indexed by the Id of their basic type.
protected  BuildQueue<BuildableType> buildQueue
          A list of Buildable items.
protected  java.util.List<ColonyTile> colonyTiles
          A list of ColonyTiles.
protected  Turn established
          The turn in which this colony was established.
protected  java.util.Map<java.lang.String,ExportData> exportData
          A map of ExportData, indexed by the Ids of GoodsTypes.
static Ability HAS_PORT
           
protected  int immigration
          The number of immigration points.
protected  boolean landLocked
           
protected  int liberty
          The number of liberty points.
static int LIBERTY_PER_REBEL
           
private static java.util.logging.Logger logger
           
protected  int oldSonsOfLiberty
          The SoL membership last turn.
protected  int oldTories
          The number of tories last turn.
static java.lang.String POPULATION_QUEUE_TAG
           
protected  BuildQueue<UnitType> populationQueue
          The colonists that may be born.
protected  int productionBonus
          The current production bonus.
private  ProductionCache productionCache
          Contains information about production and consumption.
static java.lang.String REARRANGE_WORKERS
           
static FreeColGameObjectType SOL_MODIFIER_SOURCE
           
protected  int sonsOfLiberty
          The SoL membership this turn.
protected  java.lang.String stockadeKey
           
protected  int tories
          The number of tories this turn.
protected  int unitCount
           
 
Fields inherited from class net.sf.freecol.common.model.Settlement
FOOD_PER_COLONIST, owner, tile
 
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 Colony()
           
  Colony(Game game, org.w3c.dom.Element e)
          Initiates a new Colony from an XML representation.
protected Colony(Game game, Player owner, java.lang.String name, Tile tile)
          Constructor for ServerColony.
  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
 boolean add(Locatable locatable)
          Adds a Locatable to this Location.
 void addBuilding(Building building)
          Add a Building to this Colony.
 boolean addGoods(AbstractGoods goods)
          Add goods to this colony;
 boolean addGoods(GoodsType type, int amount)
          Add goods to this colony.
private  void addInsufficientProductionMessage(java.util.List<StringTemplate> warnings, ProductionInfo info)
          adds a message about insufficient production for a building
 void addLiberty(int amount)
          Adds to the liberty points of the colony.
 boolean addUnit(Unit unit, WorkLocation loc)
          Adds a Unit to an optional WorkLocation in this 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 canBePillaged(Unit attacker)
          Determines whether this colony is sufficiently unprotected and contains something worth pillaging.
 boolean canBePlundered()
          Checks if this colony can be plundered.
 boolean canBombardEnemyShip()
          Verify if colony has the ability 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.
 void changeOwner(Player owner)
          Sets the owner of this Colony, including all units within, and change main tile nation ownership.
 ModelMessage checkForGovMgtChangeMessage()
           
 boolean contains(Locatable locatable)
          Checks if this Location contains the specified Locatable.
 void dispose()
          Disposes this Colony.
 java.util.List<FreeColGameObject> disposeList()
          Dispose of this colony.
 Unit findStudent(Unit teacher)
          Find a student for the specified teacher.
 Unit findTeacher(Unit student)
          Find a teacher for the specified student.
 int getAdjustedNetProductionOf(GoodsType goodsType)
          Returns the net production of the given GoodsType adjusted by the possible consumption of BuildQueues.
 Unit getBetterExpert(Unit expert)
          Finds another unit in this colony that would be better at doing the job of the specified 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.
 java.util.List<Building> getBurnableBuildingList()
          Gets the buildings in this colony that could be burned by a raid.
 Colony getColony()
          Returns just this Colony itself.
 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.
 void getColonyTileTodo(java.util.List<Tile> exploreTiles, java.util.List<Tile> clearTiles, java.util.List<Tile> plowTiles, java.util.List<Tile> roadTiles)
          Collects tiles that need exploring, plowing or road building which may depend on current use within the colony.
 java.util.List<Consumer> getConsumers()
          Returns a list of all Consumers in the colony sorted by priority.
 int getConsumptionOf(GoodsType goodsType)
          Returns the number of goods of a given type used by the settlement 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.
 Turn getEstablished()
          Get the Established value.
 int getExportAmount(GoodsType goodsType)
          How much of a goods type can be exported from this colony?
 ExportData getExportData(GoodsType goodsType)
          Describe getExportData method here.
 int getFoodProduction()
          Gets the combined production of all food types.
 int getGoodsCapacity()
          Returns the capacity of this colony's warehouse.
 java.util.HashMap<GoodsType,java.lang.Integer> getGoodsForBuilding(BuildableType type)
          Gets a map of the types of goods and amount thereof required to finish a buildable in this colony.
 java.lang.String getImageKey()
          Gets the image key for this colony.
 int getImmigration()
          Return the number of immigration points.
 int getImportAmount(GoodsType goodsType)
          How much of a goods type can be imported into this colony?
 int getLiberty()
          Describe getLiberty method here.
 StringTemplate getLocationName()
          Returns the name of this location.
 StringTemplate getLocationNameFor(Player player)
          Returns a suitable name for this colony for a particular player.
 java.util.List<Goods> getLootableGoodsList()
          Gets a list of all stored goods in this colony, suitable for being looted.
 int getMembers()
          Return the number of sons of liberty
 java.util.Set<Modifier> getModifierSet(java.lang.String id)
          Get the Modifier value.
 java.lang.String getNameFor(Player player)
          Gets the name of this Settlement for a particular player.
 int getNetProductionOf(GoodsType goodsType)
          Returns the net production of the given GoodsType.
 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.
 RandomRange getPlunderRange(Unit attacker)
          Gets the plunder range for this colony.
 int getPriceForBuilding()
          Returns the price for the remaining hammers and tools for the Building that is currently being built.
 int getPriceForBuilding(BuildableType type)
          Gets the price for the remaining resources to build a given buildable.
 int getProductionBonus()
          Returns the production bonus, if any, of the colony.
 ProductionInfo getProductionInfo(java.lang.Object object)
          Returns the ProductionInfo for the given Object.
protected  TypeCountMap<GoodsType> getProductionMap()
          Gets a copy of the current production map.
 Modifier getProductionModifier(GoodsType goodsType)
          Returns the current production Modifier, which is generated from the current production bonus.
 int getProductionOf(GoodsType goodsType)
          Returns the production of the given type of goods.
 java.util.List<Unit> getShipList()
          Gets a list of all ships in this colony (although they are really located on the colony tile).
 int getSoL()
          Returns the current SoL membership of the colony.
 Building getStockade()
          Returns the stockade building
 java.lang.String getStockadeKey()
          Gets the stockade key.
 java.util.List<Unit> getTeachers()
          Returns a list of all teachers currently present in the school building.
 int getTory()
          Returns the Tory membership of the colony.
 java.lang.String getTrueStockadeKey()
          Gets the true stockade key, as should be visible to the owner or a player that can see this colony.
 int getTurnsToComplete(BuildableType buildable)
          Returns how many turns it would take to build the given BuildableType.
 int getTurnsToComplete(BuildableType buildable, AbstractGoods needed)
          Returns how many turns it would take to build the given BuildableType.
 int getUnitCount()
          Gets the number of units at this colony.
 java.util.Iterator<Unit> getUnitIterator()
          Gets a Iterator of every Unit directly located on this Location.
 java.util.List<Unit> getUnitList()
          Gets a list of all units in working in this colony.
 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()
           
 java.util.Collection<StringTemplate> getWarnings(GoodsType goodsType, int amount, int production)
          determine if there is a problem with the production of the specified good
 WorkLocation getWorkLocationFor(Unit unit)
          Gets a work location within this colony to put a unit in.
 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 unitCount)
          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)
          Increment immigration points by amount given.
 void incrementLiberty(int amount)
          Increment liberty points by amount given.
 void invalidateCache()
          Invalidates the production cache.
 boolean isAutomaticBuild(BuildingType buildingType)
          Is a building type able to be automatically built at no cost.
 boolean isConnected()
          Return whether this colony is connected to the HighSeas, or not.
 boolean isLandLocked()
          Returns whether this colony is landlocked, or has access to water.
 boolean isProductive(WorkLocation workLocation)
           
 boolean isTileInUse(Tile tile)
          Is a tile actually in use by this colony?
 boolean isUndead()
          Returns whether this colony has undead units.
 boolean isUnderSiege()
          Returns true if the number of enemy combat units on all tiles that belong to the colony exceeds the number of friendly combat units.
protected  void modifySpecialGoods(GoodsType goodsType, int amount)
           
 int priceGoodsForBuilding(java.util.HashMap<GoodsType,java.lang.Integer> required)
          Gets a price for a map of resources to build a given buildable.
 boolean propagateAlarm(Player player, int addToAlarm)
          Propagates a global change in tension down to a settlement.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
protected  void readFromXMLPartialImpl(javax.xml.stream.XMLStreamReader in)
          Partial reader, so that "remove" messages can be brief.
 boolean remove(Locatable locatable)
          Removes a Locatable from this Location.
 boolean removeBuilding(Building building)
          Remove a building from this Colony.
 Goods removeGoods(AbstractGoods goods)
          Removes the given Goods from the Settlement.
 Goods removeGoods(GoodsType type)
          Removes all Goods of the given type from the Settlement.
 Goods removeGoods(GoodsType type, int amount)
          Removes a specified amount of a type of Goods from this Settlement.
 boolean removeUnit(Unit unit)
          Removes a Unit from this Colony.
 void setBuildQueue(java.util.List<BuildableType> newBuildQueue)
          Set the BuildQueue value.
 void setCurrentlyBuilding(BuildableType buildable)
          Sets the current type of buildable to be built and if it is a building insist that there is only one in the queue.
 void setEstablished(Turn newEstablished)
          Set the Established value.
 void setExportData(ExportData newExportData)
          Describe setExportData method here.
 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.
protected  void toXMLPartialImpl(javax.xml.stream.XMLStreamWriter out, java.lang.String[] fields)
          Partial writer, so that "remove" messages can be brief.
 void updatePopulation(int difference)
          Updates SoL and builds Buildings that are free if possible.
protected  void updateProductionBonus()
          Update the colony's production bonus.
 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, getConsumptionOf, getFeatureContainer, getFoodConsumption, getLineOfSight, getName, getNameKey, getOwnedTiles, getOwner, getPlunder, getRadius, getSettlement, getTile, getType, isCapital, placeSettlement, readAttributes, setCapital, setFeatureContainer, setName, setOwner, setType, writeAttributes
 
Methods inherited from class net.sf.freecol.common.model.GoodsLocation
getCompactGoods, getGoodsContainer, getGoodsCount, getGoodsIterator, getNoAddReason, getWarehouseCapacity, readChild, setGoodsContainer, writeChildren
 
Methods inherited from class net.sf.freecol.common.model.UnitLocation
getSpaceTaken, getUnitCapacity, isEmpty, isFull, readChildren, writeChildren
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute
 
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
getName, setName
 
Methods inherited from interface net.sf.freecol.common.model.Location
getId
 

Field Detail

logger

private static final java.util.logging.Logger logger

BUILD_QUEUE_TAG

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

POPULATION_QUEUE_TAG

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

REARRANGE_WORKERS

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

LIBERTY_PER_REBEL

public static final int LIBERTY_PER_REBEL
See Also:
Constant Field Values

HAS_PORT

public static final Ability HAS_PORT

SOL_MODIFIER_SOURCE

public static final FreeColGameObjectType SOL_MODIFIER_SOURCE

colonyTiles

protected final java.util.List<ColonyTile> colonyTiles
A list of ColonyTiles.


buildingMap

protected final java.util.Map<java.lang.String,Building> buildingMap
A map of Buildings, indexed by the Id of their basic type.


exportData

protected final java.util.Map<java.lang.String,ExportData> exportData
A map of ExportData, indexed by the Ids of GoodsTypes.


sonsOfLiberty

protected int sonsOfLiberty
The SoL membership this turn.


oldSonsOfLiberty

protected int oldSonsOfLiberty
The SoL membership last turn.


tories

protected int tories
The number of tories this turn.


oldTories

protected int oldTories
The number of tories last turn.


productionBonus

protected int productionBonus
The current production bonus.


immigration

protected int immigration
The number of immigration points. Immigration points are an abstract game concept. They are generated by but are not identical to crosses.


liberty

protected int liberty
The number of liberty points. Liberty points are an abstract game concept. They are generated by but are not identical to bells.


landLocked

protected boolean landLocked

unitCount

protected int unitCount

stockadeKey

protected java.lang.String stockadeKey

established

protected Turn established
The turn in which this colony was established.


buildQueue

protected BuildQueue<BuildableType> buildQueue
A list of Buildable items.


populationQueue

protected BuildQueue<UnitType> populationQueue
The colonists that may be born.


productionCache

private ProductionCache productionCache
Contains information about production and consumption.

Constructor Detail

Colony

protected Colony()

Colony

protected Colony(Game game,
                 Player owner,
                 java.lang.String name,
                 Tile tile)
Constructor for ServerColony.

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

Colony

public Colony(Game game,
              javax.xml.stream.XMLStreamReader in)
       throws javax.xml.stream.XMLStreamException
Initiates a new Colony from an XML representation.

Parameters:
game - The Game this object belongs to.
in - The input stream containing the XML.
Throws:
javax.xml.stream.XMLStreamException - if an error occurred during parsing.

Colony

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

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

Colony

public Colony(Game game,
              java.lang.String id)
Initiates a new Colony 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

getNameFor

public java.lang.String getNameFor(Player player)
Gets the name of this Settlement for a particular player.

Specified by:
getNameFor in class Settlement
Parameters:
player - A Player to return the name for.
Returns:
The name as a String.

getImageKey

public java.lang.String getImageKey()
Gets the image key for this colony.

Specified by:
getImageKey in class Settlement
Returns:
The image key.

isAutomaticBuild

public boolean isAutomaticBuild(BuildingType buildingType)
Is a building type able to be automatically built at no cost. True when the player has a modifier that collapses the cost to zero.

Parameters:
buildingType - a BuildingType value
Returns:
True if the building is available at zero cost.

addBuilding

public void addBuilding(Building building)
Add a Building to this Colony.

Parameters:
building - a Building value

removeBuilding

public boolean removeBuilding(Building building)
Remove a building from this Colony.

Parameters:
building - The Building to remove.
Returns:
True if the building was removed.

canReducePopulation

public boolean canReducePopulation()
Returns true if the colony can reduce its population voluntarily. This is generally the case, but can be prevented by buildings such as the stockade.

Returns:
a boolean value

updatePopulation

public void updatePopulation(int difference)
Updates SoL and builds Buildings that are free if possible.

Parameters:
difference - an int value

getExportData

public ExportData getExportData(GoodsType goodsType)
Describe getExportData method here.

Parameters:
goodsType - a GoodsType value
Returns:
an ExportData value

setExportData

public final void setExportData(ExportData newExportData)
Describe setExportData method here.

Parameters:
newExportData - an ExportData value

getExportAmount

public int getExportAmount(GoodsType goodsType)
How much of a goods type can be exported from this colony?

Parameters:
goodsType - The GoodsType to export.
Returns:
The amount of this type of goods available for export.

getImportAmount

public int getImportAmount(GoodsType goodsType)
How much of a goods type can be imported into this colony?

Parameters:
goodsType - The GoodsType to import.
Returns:
The amount of this type of goods that can be imported.

isLandLocked

public boolean isLandLocked()
Returns whether this colony is landlocked, or has access to water.

Returns:
true if there are no adjacent tiles to this Colony's tile being water tiles.

isConnected

public boolean isConnected()
Return whether this colony is connected to the HighSeas, or not. A colony next to a lake would not be landlocked, for example, but it might well be disconnected from Europe.

Overrides:
isConnected in class Settlement
Returns:
a boolean value

isUndead

public boolean isUndead()
Returns whether this colony has undead units.

Returns:
whether this colony has undead units.

changeOwner

public void changeOwner(Player owner)
Sets the owner of this Colony, including all units within, and change main tile nation ownership.

Overrides:
changeOwner in class Settlement
Parameters:
owner - The Player that shall own this Settlement.
See Also:
Settlement.getOwner()

setUnitCount

public void setUnitCount(int unitCount)
Sets the number of units inside the colony, used in enemy colonies

Parameters:
unitCount - The units inside the colony
See Also:
getUnitCount()

getBuildingsForProducing

public java.util.List<Building> getBuildingsForProducing(GoodsType goodsType)
Collect the buildings for producing the given type of goods.

Parameters:
goodsType - The type of goods.
Returns:
A List of Buildings which produce the given type of goods.

getBuildingsForConsuming

public java.util.List<Building> getBuildingsForConsuming(GoodsType goodsType)
Collect the buildings for consuming the given type of goods.

Parameters:
goodsType - The type of goods.
Returns:
A List of Buildings which consume the given type of goods.
See Also:
Goods

getBuildingForProducing

public Building getBuildingForProducing(GoodsType goodsType)
Find a building for producing the given type of goods.

Parameters:
goodsType - The type of goods.
Returns:
A Building which produces the given type of goods, or null if such a building can not be found.

getBuildingForConsuming

public Building getBuildingForConsuming(GoodsType goodsType)
Find a building for consuming the given type of goods.

Parameters:
goodsType - The type of goods.
Returns:
A Building which consumes the given type of goods, or null if such a building can not be found.

getWorkLocations

public java.util.List<WorkLocation> getWorkLocations()
Gets a List of every WorkLocation in this Colony.

Returns:
The List.
See Also:
WorkLocation

getBuildings

public java.util.List<Building> getBuildings()
Gets a List of every Building in this Colony.

Returns:
The List.
See Also:
Building

getColonyTiles

public java.util.List<ColonyTile> getColonyTiles()
Gets a List of every ColonyTile in this Colony.

Returns:
The List.
See Also:
ColonyTile

isTileInUse

public boolean isTileInUse(Tile tile)
Is a tile actually in use by this colony?

Parameters:
tile - The Tile to test.
Returns:
True if this tile is actively in use by this colony.

getBuilding

public Building getBuilding(BuildingType type)
Gets a Building of the specified type.

Parameters:
type - The type of the building to get.
Returns:
The Building.

getBuildingWithAbility

public Building getBuildingWithAbility(java.lang.String ability)
Returns a Building with the given Ability, or null, if none exists.

Parameters:
ability - a String value
Returns:
a Building value

getColonyTile

public ColonyTile getColonyTile(Tile t)
Returns the ColonyTile matching the given Tile.

Parameters:
t - The Tile to get the ColonyTile for.
Returns:
The ColonyTile

incrementLiberty

public void incrementLiberty(int amount)
Increment liberty points by amount given.

Parameters:
amount - an int value

incrementImmigration

public void incrementImmigration(int amount)
Increment immigration points by amount given.

Parameters:
amount - an int value

getEstablished

public Turn getEstablished()
Get the Established value.

Returns:
a Turn value

setEstablished

public void setEstablished(Turn newEstablished)
Set the Established value.

Parameters:
newEstablished - The new Established value.

add

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

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

remove

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

Specified by:
remove in interface Location
Overrides:
remove in class GoodsLocation
Parameters:
locatable - The Locatable to remove from this Location.
Returns:
True if the remove succeeded.

getWorkLocationFor

public WorkLocation getWorkLocationFor(Unit unit)
Gets a work location within this colony to put a unit in.

Parameters:
unit - The Unit to place.
Returns:
A work location for the unit, or null if none available.

addUnit

public boolean addUnit(Unit unit,
                       WorkLocation loc)
Adds a Unit to an optional WorkLocation in this Colony.

Parameters:
unit - The Unit to add.
loc - The WorkLocation to add to (if null, one is chosen.
Returns:
True if the add succeeded.

removeUnit

public boolean removeUnit(Unit unit)
Removes a Unit from this Colony.

Parameters:
unit - The Unit to remove.
Returns:
True if the remove succeeded.

addGoods

public boolean addGoods(AbstractGoods goods)
Add goods to this colony;

Overrides:
addGoods in class GoodsLocation
Parameters:
goods - an AbstractGoods value

addGoods

public boolean addGoods(GoodsType type,
                        int amount)
Add goods to this colony.

Overrides:
addGoods in class GoodsLocation
Parameters:
type - a GoodsType value
amount - an int value

removeGoods

public Goods removeGoods(GoodsType type,
                         int amount)
Removes a specified amount of a type of Goods from this Settlement.

Overrides:
removeGoods in class GoodsLocation
Parameters:
type - The type of Goods to remove from this settlement.
amount - The amount of Goods to remove from this settlement.

removeGoods

public Goods removeGoods(AbstractGoods goods)
Removes the given Goods from the Settlement.

Overrides:
removeGoods in class GoodsLocation
Parameters:
goods - a Goods value

removeGoods

public Goods removeGoods(GoodsType type)
Removes all Goods of the given type from the Settlement.

Overrides:
removeGoods in class GoodsLocation
Parameters:
type - a GoodsType value

modifySpecialGoods

protected void modifySpecialGoods(GoodsType goodsType,
                                  int amount)

getUnitCount

public int getUnitCount()
Gets the number of units at this colony. Units are located in a WorkLocations.

Specified by:
getUnitCount in interface Location
Overrides:
getUnitCount in class UnitLocation
Returns:
The number of Units in this colony.

getUnitList

public java.util.List<Unit> getUnitList()
Gets a list of all units in working in this colony.

Specified by:
getUnitList in interface Location
Overrides:
getUnitList in class UnitLocation
Returns:
A list of Units in this colony.

getUnitIterator

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

Specified by:
getUnitIterator in interface Location
Overrides:
getUnitIterator in class UnitLocation
Returns:
The Iterator.

contains

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

Specified by:
contains in interface Location
Overrides:
contains in class GoodsLocation
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 class: UnitLocation
Checks whether or not the specified locatable may be added to this Location.

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

canTrain

public 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. @see Building#canAdd

Parameters:
unit - The unit to add as a teacher.
Returns:
true if this unit type could be added.

canTrain

public 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. The number of units already in the schoolhouse and the availability of pupils are not taken into account. @see Building#canAdd

Parameters:
unitType - The unit type to add as a teacher.
Returns:
true if this unit type could be added.

getTeachers

public java.util.List<Unit> getTeachers()
Returns a list of all teachers currently present in the school building.


findTeacher

public Unit findTeacher(Unit student)
Find a teacher for the specified student. Do not search if ALLOW_STUDENT_SELECTION is true--- its the player's job then.

Parameters:
student - The student Unit that needs a teacher.
Returns:
A potential teacher, or null of none found.

findStudent

public Unit findStudent(Unit teacher)
Find a student for the specified teacher. Do not search if ALLOW_STUDENT_SELECTION is true--- its the player's job then.

Parameters:
teacher - The teacher Unit that needs a student.
Returns:
A potential student, or null of none found.

getDefendingUnit

public Unit getDefendingUnit(Unit attacker)
Gets the 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.

Specified by:
getDefendingUnit in class Settlement
Parameters:
attacker - The unit that would be attacking this colony.
Returns:
The 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.
Throws:
java.lang.IllegalStateException - if there are units in the colony
See Also:
Tile.getDefendingUnit(Unit)

canBePillaged

public boolean canBePillaged(Unit attacker)
Determines whether this colony is sufficiently unprotected and contains something worth pillaging. To be called by CombatModels when the attacker has defeated an unarmed colony defender.

Parameters:
attacker - The Unit that has defeated the defender.
Returns:
True if the attacker can pillage this colony.

canBePlundered

public boolean canBePlundered()
Checks if this colony can be plundered. That is, can it yield non-zero gold.

Returns:
True if at least one piece of gold can be plundered from this colony.

isUnderSiege

public boolean isUnderSiege()
Returns true if the number of enemy combat units on all tiles that belong to the colony exceeds the number of friendly combat units. At the moment, only the colony owner's own units are considered friendly, but that could be extended to include the units of allied players. TODO: if a colony is under siege, it should not be possible to put units outside the colony, unless those units are armed.

Returns:
a boolean value

getBurnableBuildingList

public java.util.List<Building> getBurnableBuildingList()
Gets the buildings in this colony that could be burned by a raid.

Returns:
A list of burnable buildings.

getShipList

public java.util.List<Unit> getShipList()
Gets a list of all ships in this colony (although they are really located on the colony tile).

Returns:
A list of ships in this colony.

getLootableGoodsList

public java.util.List<Goods> getLootableGoodsList()
Gets a list of all stored goods in this colony, suitable for being looted.

Returns:
A list of lootable goods in this colony.

getPlunderRange

public RandomRange getPlunderRange(Unit attacker)
Gets the plunder range for this colony.

Specified by:
getPlunderRange in class Settlement
Parameters:
attacker - An attacking Unit.
Returns:
The plunder range.

getBuildableUnits

public java.util.List<UnitType> getBuildableUnits()
Returns a List with every unit type this colony may build.

Returns:
A List with UnitType

getCurrentlyBuilding

public BuildableType getCurrentlyBuilding()
Returns the type of building currently being built.

Returns:
The type of building currently being built.

setCurrentlyBuilding

public void setCurrentlyBuilding(BuildableType buildable)
Sets the current type of buildable to be built and if it is a building insist that there is only one in the queue.

Parameters:
buildable - The BuildableType to build.

getTurnsToComplete

public int getTurnsToComplete(BuildableType buildable)
Returns how many turns it would take to build the given BuildableType.

Parameters:
buildable - The BuildableType to build.
Returns:
The number of turns to build the buildable, negative if some goods are not being built, UNDEFINED if none is.

getTurnsToComplete

public int getTurnsToComplete(BuildableType buildable,
                              AbstractGoods needed)
Returns how many turns it would take to build the given BuildableType.

Parameters:
buildable - The BuildableType to build.
needed - The AbstractGoods needed to continue the build.
Returns:
The number of turns to build the buildable, negative if some goods are not being built, UNDEFINED if none is.

getBuildQueue

public java.util.List<BuildableType> getBuildQueue()
Get the BuildQueue value.

Returns:
a List value

setBuildQueue

public void setBuildQueue(java.util.List<BuildableType> newBuildQueue)
Set the BuildQueue value.

Parameters:
newBuildQueue - The new BuildQueue value.

getLiberty

public int getLiberty()
Describe getLiberty method here.

Returns:
an int value

addLiberty

public void addLiberty(int amount)
Adds to the liberty points of the colony. Used only by DebugMenu.

Parameters:
amount - The number of liberty to add.

getImmigration

public int getImmigration()
Return the number of immigration points.

Returns:
an int value

getConsumptionOf

public int getConsumptionOf(GoodsType goodsType)
Returns the number of goods of a given type used by the settlement each turn.

Overrides:
getConsumptionOf in class Settlement
Parameters:
goodsType - GoodsType values
Returns:
an int value

getSoL

public int getSoL()
Returns the current SoL membership of the colony.

Specified by:
getSoL in class Settlement
Returns:
The current SoL membership of the colony.

updateSoL

public void updateSoL()
Calculates the current SoL membership of the colony based on the liberty value and colonists.


calculateMembership

public int calculateMembership(int units)
Returns the SoL membership of the colony based on the liberty value and the number of colonists given.

Parameters:
units - an int value
Returns:
an int value

getMembers

public int getMembers()
Return the number of sons of liberty


getTory

public int getTory()
Returns the Tory membership of the colony.

Returns:
The current Tory membership of the colony.

getProductionBonus

public int getProductionBonus()
Returns the production bonus, if any, of the colony.

Returns:
The current production bonus of the colony.

getProductionModifier

public Modifier getProductionModifier(GoodsType goodsType)
Returns the current production Modifier, which is generated from the current production bonus.

Parameters:
goodsType - a GoodsType value
Returns:
a Modifier value

toString

public java.lang.String toString()
Gets a string representation of the Colony. Currently this method just returns the name of the Colony, but that may change later.

Overrides:
toString in class FreeColGameObject
Returns:
The name of the colony.
See Also:
Settlement.getName()

getLocationName

public StringTemplate getLocationName()
Returns the name of this location.

Specified by:
getLocationName in interface Location
Overrides:
getLocationName in class UnitLocation
Returns:
The name of this location.

getLocationNameFor

public StringTemplate getLocationNameFor(Player player)
Returns a suitable name for this colony for a particular player.

Specified by:
getLocationNameFor in interface Location
Overrides:
getLocationNameFor in class UnitLocation
Parameters:
player - The Player to prepare the name for.
Returns:
The name of this colony.

getFoodProduction

public int getFoodProduction()
Gets the combined production of all food types.

Returns:
an int value

getProductionOf

public int getProductionOf(GoodsType goodsType)
Returns the production of the given type of goods.

Specified by:
getProductionOf in class Settlement
Parameters:
goodsType - The type of goods to get the production for.
Returns:
The production of the given type of goods the current turn by all of the Colony's buildings and tiles.

getVacantWorkLocationFor

public WorkLocation getVacantWorkLocationFor(Unit unit)
Gets a vacant WorkLocation for the given Unit.

Parameters:
unit - The Unit
Returns:
A vacant WorkLocation for the given Unit or null if there is no such location.

getOccupationFor

private Colony.Occupation getOccupationFor(Unit unit)
Returns an Occupation for the given Unit.

Parameters:
unit - The Unit
Returns:
An Occupation for the given Unit or null if there is none.

getBuildingFor

public Building getBuildingFor(Unit unit)
Return the Building best suited for the given Unit.

Parameters:
unit - an Unit value
Returns:
a Building value

getVacantColonyTileFor

public ColonyTile getVacantColonyTileFor(Unit unit,
                                         boolean allowClaim,
                                         GoodsType... goodsTypes)
Returns a vacant ColonyTile where the given unit produces the maximum output of the given goodsType.

Parameters:
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.
Returns:
The 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.

canBreed

public boolean canBreed(GoodsType goodsType)
Returns true if this Colony can breed the given type of Goods. Only animals (such as horses) are expected to be breedable.

Parameters:
goodsType - a GoodsType value
Returns:
a boolean value

canBuild

public boolean canBuild()
Describe canBuild method here.

Returns:
a boolean value

canBuild

public boolean canBuild(BuildableType buildableType)
Returns true if this Colony can build the given BuildableType.

Parameters:
buildableType - a BuildableType value
Returns:
a boolean value

getNoBuildReason

public Colony.NoBuildReason getNoBuildReason(BuildableType buildableType)
Return the reason why the give BuildableType can not be built.

Parameters:
buildableType - a BuildableType value
Returns:
a NoBuildReason value

getPriceForBuilding

public int getPriceForBuilding()
Returns the price for the remaining hammers and tools for the Building that is currently being built.

Returns:
The price.
See Also:
InGameController.payForBuilding(net.sf.freecol.common.model.Colony)

getPriceForBuilding

public int getPriceForBuilding(BuildableType type)
Gets the price for the remaining resources to build a given buildable.

Parameters:
type - The BuildableType to build.
Returns:
The price.
See Also:
InGameController.payForBuilding(net.sf.freecol.common.model.Colony)

priceGoodsForBuilding

public int priceGoodsForBuilding(java.util.HashMap<GoodsType,java.lang.Integer> required)
Gets a price for a map of resources to build a given buildable.

Parameters:
required - The map of resources required.
Returns:
The price.
See Also:
InGameController.payForBuilding(net.sf.freecol.common.model.Colony)

getGoodsForBuilding

public java.util.HashMap<GoodsType,java.lang.Integer> getGoodsForBuilding(BuildableType type)
Gets a map of the types of goods and amount thereof required to finish a buildable in this colony.

Parameters:
type - The BuildableType to build.
Returns:
The map to completion.

canPayToFinishBuilding

public boolean canPayToFinishBuilding()
Check if the owner can buy the remaining hammers and tools for the Building that is currently being built.

Throws:
java.lang.IllegalStateException - If the owner of this Colony has an insufficient amount of gold.
See Also:
getPriceForBuilding()

canPayToFinishBuilding

public boolean canPayToFinishBuilding(BuildableType buildableType)
Check if the owner can buy the remaining hammers and tools for the Building given.

Parameters:
buildableType - a BuildableType value
Returns:
a boolean value
Throws:
java.lang.IllegalStateException - If the owner of this Colony has an insufficient amount of gold.
See Also:
getPriceForBuilding()

getWarnings

public java.util.Collection<StringTemplate> getWarnings(GoodsType goodsType,
                                                        int amount,
                                                        int production)
determine if there is a problem with the production of the specified good

Parameters:
goodsType - for this good
amount - warehouse amount
production - production per turn
Returns:
all warnings

addInsufficientProductionMessage

private void addInsufficientProductionMessage(java.util.List<StringTemplate> warnings,
                                              ProductionInfo info)
adds a message about insufficient production for a building

Parameters:
warnings - where to add the warnings
info - the ProductionInfo for this building

governmentChange

public int governmentChange(int unitCount)
Returns 1, 0, or -1 to indicate that government would improve, remain the same, or deteriorate if the colony had the given population.

Parameters:
unitCount - The proposed population for the colony.
Returns:
1, 0 or -1.

checkForGovMgtChangeMessage

public ModelMessage checkForGovMgtChangeMessage()

updateProductionBonus

protected void updateProductionBonus()
Update the colony's production bonus.


propagateAlarm

public boolean propagateAlarm(Player player,
                              int addToAlarm)
Propagates a global change in tension down to a settlement. No-op for European colonies.

Specified by:
propagateAlarm in class Settlement
Parameters:
player - The Player towards whom the alarm is felt.
addToAlarm - The amount to add to the current alarm level.
Returns:
True if the settlement alarm level changes as a result of this change.

getGoodsCapacity

public int getGoodsCapacity()
Returns the capacity of this colony's warehouse. All goods above this limit, except Food, will be removed by the end-of-turn processing.

Specified by:
getGoodsCapacity in class GoodsLocation
Returns:
The capacity of this Colony's warehouse.

getWarehouse

public Building getWarehouse()

getColony

public Colony getColony()
Returns just this Colony itself.

Specified by:
getColony in interface Location
Overrides:
getColony in class UnitLocation
Returns:
this colony.

hasStockade

public boolean hasStockade()
Returns true when colony has a stockade

Returns:
whether the colony has a stockade

getStockade

public Building getStockade()
Returns the stockade building

Returns:
a Building

getStockadeKey

public java.lang.String getStockadeKey()
Gets the stockade key. Uses the "stockadeKey" variable if it is non-null, which should only be true for other player colonies. Otherwise, get the real value.

Returns:
The stockade key.

getTrueStockadeKey

public java.lang.String getTrueStockadeKey()
Gets the true stockade key, as should be visible to the owner or a player that can see this colony.

Returns:
The true stockade key.

getModifierSet

public final java.util.Set<Modifier> getModifierSet(java.lang.String id)
Get the Modifier value.

Overrides:
getModifierSet in class Settlement
Parameters:
id - a String value
Returns:
a Modifier value

hasAbility

public boolean hasAbility(java.lang.String id)
Returns true if the Colony, or its owner has the ability identified by id.

Overrides:
hasAbility in class FreeColObject
Parameters:
id - a String value
Returns:
a boolean value

hasAbility

public boolean hasAbility(java.lang.String id,
                          FreeColGameObjectType type)
Returns true if the Colony, or its owner has the ability identified by id.

Parameters:
id - a String value
type - a FreeColGameObjectType value
Returns:
a boolean value

canBombardEnemyShip

public boolean canBombardEnemyShip()
Verify if colony has the ability to bombard an enemy ship adjacent to it.

Returns:
true if it can, false otherwise

disposeList

public java.util.List<FreeColGameObject> disposeList()
Dispose of this colony.

Overrides:
disposeList in class Settlement
Returns:
A list of disposed objects.

dispose

public void dispose()
Disposes this Colony. All WorkLocations owned by this Colony will also be destroyed.

Overrides:
dispose in class GoodsLocation

getNetProductionOf

public int getNetProductionOf(GoodsType goodsType)
Returns the net production of the given GoodsType.

Parameters:
goodsType - a GoodsType value
Returns:
an int value

isProductive

public boolean isProductive(WorkLocation workLocation)

getAdjustedNetProductionOf

public int getAdjustedNetProductionOf(GoodsType goodsType)
Returns the net production of the given GoodsType adjusted by the possible consumption of BuildQueues.

Parameters:
goodsType - a GoodsType value
Returns:
an int value

getProductionInfo

public ProductionInfo getProductionInfo(java.lang.Object object)
Returns the ProductionInfo for the given Object.

Parameters:
object - an Object value
Returns:
a ProductionInfo value

invalidateCache

public void invalidateCache()
Invalidates the production cache.


getProductionMap

protected TypeCountMap<GoodsType> getProductionMap()
Gets a copy of the current production map. Useful in the server at the point net production is applied to a colony.

Returns:
A copy of the current production map.

getConsumers

public java.util.List<Consumer> getConsumers()
Returns a list of all Consumers in the colony sorted by priority. Consumers include all object that consume goods, e.g. Units, Buildings and BuildQueues.

Returns:
a list of consumers

getColonyTileTodo

public void getColonyTileTodo(java.util.List<Tile> exploreTiles,
                              java.util.List<Tile> clearTiles,
                              java.util.List<Tile> plowTiles,
                              java.util.List<Tile> roadTiles)
Collects tiles that need exploring, plowing or road building which may depend on current use within the colony.

Parameters:
exploreTiles - A list of Tiles to update with tiles to explore.
clearTiles - A list of Tiles to update with tiles to clear.
plowTiles - A list of Tiles to update with tiles to plow.
roadTiles - A list of Tiles to update with tiles to build roads on.

getBetterExpert

public Unit getBetterExpert(Unit expert)
Finds another unit in this colony that would be better at doing the job of the specified unit.

Parameters:
expert - The Unit to consider.
Returns:
A better expert, or null if none available.

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.

toXMLPartialImpl

protected void toXMLPartialImpl(javax.xml.stream.XMLStreamWriter out,
                                java.lang.String[] fields)
                         throws javax.xml.stream.XMLStreamException
Partial writer, so that "remove" messages can be brief.

Overrides:
toXMLPartialImpl in class FreeColObject
Parameters:
out - The target stream.
fields - The fields to write.
Throws:
javax.xml.stream.XMLStreamException - If there are problems writing the stream.

readFromXMLPartialImpl

protected void readFromXMLPartialImpl(javax.xml.stream.XMLStreamReader in)
                               throws javax.xml.stream.XMLStreamException
Partial reader, so that "remove" messages can be brief.

Overrides:
readFromXMLPartialImpl in class FreeColObject
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - If there are problems reading the stream.

getXMLElementTagName

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

Returns:
"colony".