|
|||||||||
| 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.FreeColGameObjectType
net.sf.freecol.common.model.BuildableType
net.sf.freecol.common.model.BuildingType
public final class BuildingType
Encapsulates data common to all instances of a particular kind of
Building, such as the number of workplaces, and the types
of goods it produces and consumes.
| Field Summary | |
|---|---|
private int |
basicProduction
|
private GoodsType |
consumes
|
private int |
level
|
private int |
maxSkill
|
private int |
minSkill
|
private int |
priority
|
private GoodsType |
produces
|
private Modifier |
productionModifier
|
private BuildingType |
upgradesFrom
|
private BuildingType |
upgradesTo
|
private int |
upkeep
|
private int |
workPlaces
|
| Fields inherited from class net.sf.freecol.common.model.BuildableType |
|---|
NOTHING |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
BuildingType(java.lang.String id,
Specification specification)
Creates a new BuildingType instance. |
|
| Method Summary | |
|---|---|
boolean |
canAdd(UnitType unitType)
Returns true if the given UnitType could be added to a Building of this type. |
int |
compareTo(BuildingType other)
Compares this BuildingType to another. |
void |
fixup09x()
0.9.x compatibility hack, called from the specification reader when it is finishing up. |
int |
getBasicProduction()
Returns the production of a single Unit in this BuildingType before any modifiers are applied. |
GoodsType |
getConsumedGoodsType()
Returns the type of goods consumed by this BuildingType. |
BuildingType |
getFirstLevel()
Returns the first level of this BuildingType. |
int |
getLevel()
Returns the level of this BuildingType. |
int |
getModifierIndex(Modifier modifier)
Get the index for the given Modifier. |
int |
getPriority()
The consumption priority of a Building of this type. |
GoodsType |
getProducedGoodsType()
Returns the type of goods produced by this BuildingType. |
Modifier |
getProductionModifier()
Describe getProductionModifier method here. |
FreeColGameObjectType |
getType()
Describe getType method here. |
BuildingType |
getUpgradesFrom()
Returns the BuildingType this BuildingType upgrades from. |
BuildingType |
getUpgradesTo()
Returns the BuildingType this BuildingType upgrades to. |
int |
getUpkeep()
Returns the amount of gold necessary to maintain a Building of this type for one turn. |
int |
getWorkPlaces()
Returns the number of workplaces, that is the maximum number of Units that can work in this BuildingType. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
isAutomaticBuild()
Is this building type automatically built in any colony? |
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
Reads the attributes of this object from an XML stream. |
protected void |
readChildren(javax.xml.stream.XMLStreamReader in)
Reads the children of this object from an XML stream. |
void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Makes an XML-representation of this object. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
Write the attributes of this object to a stream. |
| Methods inherited from class net.sf.freecol.common.model.BuildableType |
|---|
getAbilitiesRequired, getAmountRequiredOf, getGoodsRequired, getLimits, getPopulationRequired, needsGoodsToBuild, readChild, setGoodsRequired, setLimits, setPopulationRequired, writeChildren |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType |
|---|
addAbility, addModifier, applyDifficultyLevel, getDescriptionKey, getFeatureContainer, getIndex, getModifierIndex, getModifierSet, getNameKey, getSpecification, hasAbility, hasAbility, isAbstractType, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, setSpecification, toString, toXMLImpl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int level
private int workPlaces
private int basicProduction
private int minSkill
private int maxSkill
private int upkeep
private int priority
private GoodsType consumes
private GoodsType produces
private Modifier productionModifier
private BuildingType upgradesFrom
private BuildingType upgradesTo
| Constructor Detail |
|---|
public BuildingType(java.lang.String id,
Specification specification)
BuildingType instance.
id - a String valuespecification - a Specification value| Method Detail |
|---|
public BuildingType getUpgradesFrom()
BuildingType valuepublic BuildingType getUpgradesTo()
BuildingType valuepublic BuildingType getFirstLevel()
BuildingType valuepublic int getWorkPlaces()
int valuepublic int getBasicProduction()
int valuepublic GoodsType getConsumedGoodsType()
GoodsType valuepublic GoodsType getProducedGoodsType()
GoodsType valuepublic int getLevel()
int valuepublic int getUpkeep()
int valuepublic int getPriority()
int valuepublic FreeColGameObjectType getType()
getType method here.
FreeColGameObjectType valuepublic Modifier getProductionModifier()
getProductionModifier method here.
Modifier valuepublic int compareTo(BuildingType other)
compareTo in interface java.lang.Comparable<BuildingType>other - a BuildingType value
int valuepublic boolean canAdd(UnitType unitType)
unitType - an UnitType value
boolean valuepublic boolean isAutomaticBuild()
boolean valuepublic final int getModifierIndex(Modifier modifier)
getModifierIndex in class FreeColGameObjectTypemodifier - a Modifier value
int value
public void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColGameObjectTypeout - The output stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class BuildableTypeout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to
the stream.
protected void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class FreeColGameObjectTypein - The XML input stream.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected void readChildren(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readChildren in class FreeColGameObjectTypein - The XML input stream.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public void fixup09x()
public static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||