net.sf.freecol.common.model
Class BuildableType

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObjectType
          extended by net.sf.freecol.common.model.BuildableType
Direct Known Subclasses:
BuildingType, EquipmentType, UnitType

public abstract class BuildableType
extends FreeColGameObjectType

Contains information on buildable types.


Field Summary
private  java.util.List<AbstractGoods> goodsRequired
          A list of AbstractGoods required to build this type.
private  java.util.List<Limit> limits
          Limits on the production of this type.
static java.lang.String NOTHING
           
private  int populationRequired
          The minimum population that a Colony needs in order to build this type.
private  java.util.Map<java.lang.String,java.lang.Boolean> requiredAbilities
          Stores the abilities required by this Type.
 
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
BuildableType(java.lang.String id, Specification specification)
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Boolean> getAbilitiesRequired()
          Returns the abilities required by this Type.
 int getAmountRequiredOf(GoodsType type)
          Get amount required of given GoodsType
 java.util.List<AbstractGoods> getGoodsRequired()
          Get the GoodsRequired value.
 java.util.List<Limit> getLimits()
          Get the Limits value.
 int getPopulationRequired()
          Get the PopulationRequired value.
 boolean needsGoodsToBuild()
          Does this buildable need goods to build?
protected  void readChild(javax.xml.stream.XMLStreamReader in)
          Reads a child object.
 void setGoodsRequired(java.util.List<AbstractGoods> newGoodsRequired)
          Set the GoodsRequired value.
 void setLimits(java.util.List<Limit> newLimits)
          Set the Limits value.
 void setPopulationRequired(int newPopulationRequired)
          Set the PopulationRequired value.
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
protected  void writeChildren(javax.xml.stream.XMLStreamWriter out)
          Write the children of this object to a stream.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, applyDifficultyLevel, getDescriptionKey, getFeatureContainer, getIndex, getModifierIndex, getModifierIndex, getModifierSet, getNameKey, getSpecification, hasAbility, hasAbility, isAbstractType, readAttributes, readChildren, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, setSpecification, toString, toXMLImpl, toXMLImpl
 
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, getXMLElementTagName, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTHING

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

populationRequired

private int populationRequired
The minimum population that a Colony needs in order to build this type.


limits

private java.util.List<Limit> limits
Limits on the production of this type.


goodsRequired

private java.util.List<AbstractGoods> goodsRequired
A list of AbstractGoods required to build this type.


requiredAbilities

private final java.util.Map<java.lang.String,java.lang.Boolean> requiredAbilities
Stores the abilities required by this Type.

Constructor Detail

BuildableType

public BuildableType(java.lang.String id,
                     Specification specification)
Method Detail

getGoodsRequired

public final java.util.List<AbstractGoods> getGoodsRequired()
Get the GoodsRequired value.

Returns:
a List value

getAmountRequiredOf

public final int getAmountRequiredOf(GoodsType type)
Get amount required of given GoodsType


setGoodsRequired

public final void setGoodsRequired(java.util.List<AbstractGoods> newGoodsRequired)
Set the GoodsRequired value.

Parameters:
newGoodsRequired - The new GoodsRequired value.

needsGoodsToBuild

public boolean needsGoodsToBuild()
Does this buildable need goods to build?


getPopulationRequired

public int getPopulationRequired()
Get the PopulationRequired value.

Returns:
an int value

setPopulationRequired

public void setPopulationRequired(int newPopulationRequired)
Set the PopulationRequired value.

Parameters:
newPopulationRequired - The new PopulationRequired value.

getLimits

public final java.util.List<Limit> getLimits()
Get the Limits value.

Returns:
a List value

setLimits

public final void setLimits(java.util.List<Limit> newLimits)
Set the Limits value.

Parameters:
newLimits - The new Limits value.

getAbilitiesRequired

public java.util.Map<java.lang.String,java.lang.Boolean> getAbilitiesRequired()
Returns the abilities required by this Type.

Returns:
the abilities required by this Type.

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                        throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeChildren

protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
                      throws javax.xml.stream.XMLStreamException
Write the children of this object to a stream.

Overrides:
writeChildren in class FreeColGameObjectType
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readChild

protected void readChild(javax.xml.stream.XMLStreamReader in)
                  throws javax.xml.stream.XMLStreamException
Reads a child object.

Overrides:
readChild in class FreeColGameObjectType
Parameters:
in - The XML stream to read.
Throws:
javax.xml.stream.XMLStreamException - if an error occurs