net.sf.freecol.common.model
Class GoodsType

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.GoodsType

public final class GoodsType
extends FreeColGameObjectType


Field Summary
private  int breedingNumber
          The number of units required to breed this type of goods.
private  boolean buildingMaterial
          Whether this type of goods is required for building.
private  boolean ignoreLimit
           
private  int initialAmount
           
private  int initialPrice
           
private  boolean isFarmed
           
private  boolean isFood
           
private  GoodsType madeFrom
           
private  GoodsType makes
           
private  boolean militaryGoods
          Whether this type of goods is required for building equipment that grants an offence bonus or defence bonus.
private  boolean newWorldGoods
           
private  int price
          The price of this type of goods.
private  int priceDiff
           
private  boolean storable
          Whether this type of goods can be stored in a warehouse.
private  GoodsType storedAs
           
private  boolean tradeGoods
          Whether these are trade goods that can only be obtained in Europe.
 
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
GoodsType(java.lang.String id, Specification specification)
           
 
Method Summary
 int getBreedingNumber()
          Get the BreedingNumber value.
 int getInitialAmount()
           
 int getInitialBuyPrice()
           
 int getInitialSellPrice()
           
 StringTemplate getLabel(boolean sellable)
           
 int getPrice()
          Get the Price value.
 int getPriceDifference()
           
 GoodsType getProducedMaterial()
           
 java.util.List<GoodsType> getProductionChain()
          Returns the production chain of the goods type, beginning with a raw material that can not be produced from any other.
 GoodsType getRawMaterial()
           
 GoodsType getStoredAs()
           
 java.lang.String getWorkingAsKey()
           
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 GoodsType inputType()
           
 boolean isBreedable()
          Returns true if this type of Goods is breedable.
 boolean isBuildingMaterial()
          Returns true if this type of goods is required for building a BuildableType.
 boolean isFarmed()
           
 boolean isFoodType()
           
 boolean isImmigrationGoodsType()
          Whether this type of goods causes immigration.
 boolean isImmigrationType()
          Get the ImmigrationType value.
 boolean isLibertyGoodsType()
          Whether this type of goods produces liberty points.
 boolean isLibertyType()
          Get the LibertyType value.
 boolean isMilitaryGoods()
          Get the MilitaryGoods value.
 boolean isNewWorldGoodsType()
           
 boolean isNewWorldLuxuryType()
           
 boolean isRawBuildingMaterial()
          Returns true if this type of goods is required for producing a type of goods required for building a BuildableType.
 boolean isRawMaterial()
           
 boolean isRefined()
           
 boolean isStorable()
           
 boolean isStoredAs()
           
 boolean isTradeGoods()
          Get the TradeGoods value.
 boolean limitIgnored()
           
 GoodsType outputType()
           
protected  void readAttributes(javax.xml.stream.XMLStreamReader in)
          Reads the attributes of this object from an XML stream.
protected  void readChild(javax.xml.stream.XMLStreamReader in)
          Reads a child object.
 void setBreedingNumber(int newBreedingNumber)
          Set the BreedingNumber value.
 void setBuildingMaterial(boolean newBuildingMaterial)
          Set the BuildingMaterial value.
 void setMilitaryGoods(boolean newMilitaryGoods)
          Set the MilitaryGoods value.
 void setPrice(int newPrice)
          Set the Price value.
protected  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.
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, hasAbility, hasAbility, isAbstractType, readChildren, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, toString, 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, getSpecification, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, 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

isFarmed

private boolean isFarmed

isFood

private boolean isFood

ignoreLimit

private boolean ignoreLimit

newWorldGoods

private boolean newWorldGoods

buildingMaterial

private boolean buildingMaterial
Whether this type of goods is required for building.


militaryGoods

private boolean militaryGoods
Whether this type of goods is required for building equipment that grants an offence bonus or defence bonus.


tradeGoods

private boolean tradeGoods
Whether these are trade goods that can only be obtained in Europe.


storable

private boolean storable
Whether this type of goods can be stored in a warehouse.


madeFrom

private GoodsType madeFrom

makes

private GoodsType makes

storedAs

private GoodsType storedAs

initialAmount

private int initialAmount

initialPrice

private int initialPrice

priceDiff

private int priceDiff

breedingNumber

private int breedingNumber
The number of units required to breed this type of goods. This obviously only applies to animals.


price

private int price
The price of this type of goods. This is only used for goods that can not be traded in the market, such as hammers.

Constructor Detail

GoodsType

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

getLabel

public StringTemplate getLabel(boolean sellable)

isRawMaterial

public boolean isRawMaterial()

isRefined

public boolean isRefined()

getRawMaterial

public GoodsType getRawMaterial()

getProducedMaterial

public GoodsType getProducedMaterial()

isFarmed

public boolean isFarmed()

limitIgnored

public boolean limitIgnored()

isNewWorldGoodsType

public boolean isNewWorldGoodsType()

isNewWorldLuxuryType

public boolean isNewWorldLuxuryType()

getWorkingAsKey

public final java.lang.String getWorkingAsKey()

isImmigrationType

public boolean isImmigrationType()
Get the ImmigrationType value.

Returns:
a boolean value

isLibertyType

public boolean isLibertyType()
Get the LibertyType value.

Returns:
a boolean value

isStorable

public boolean isStorable()

isStoredAs

public boolean isStoredAs()

getStoredAs

public GoodsType getStoredAs()

getInitialAmount

public int getInitialAmount()

getInitialSellPrice

public int getInitialSellPrice()

getInitialBuyPrice

public int getInitialBuyPrice()

getPriceDifference

public int getPriceDifference()

isFoodType

public boolean isFoodType()

outputType

public GoodsType outputType()

inputType

public GoodsType inputType()

isBuildingMaterial

public boolean isBuildingMaterial()
Returns true if this type of goods is required for building a BuildableType.

Returns:
a boolean value
See Also:
BuildableType

setBuildingMaterial

public void setBuildingMaterial(boolean newBuildingMaterial)
Set the BuildingMaterial value.

Parameters:
newBuildingMaterial - The new BuildingMaterial value.

getProductionChain

public java.util.List<GoodsType> getProductionChain()
Returns the production chain of the goods type, beginning with a raw material that can not be produced from any other. The last element of the production chain is the goods type itself.

Returns:
the production chain of the goods type

isRawBuildingMaterial

public boolean isRawBuildingMaterial()
Returns true if this type of goods is required for producing a type of goods required for building a BuildableType.

Returns:
a boolean value
See Also:
BuildableType

isMilitaryGoods

public boolean isMilitaryGoods()
Get the MilitaryGoods value.

Returns:
a boolean value

setMilitaryGoods

public void setMilitaryGoods(boolean newMilitaryGoods)
Set the MilitaryGoods value.

Parameters:
newMilitaryGoods - The new MilitaryGoods value.

isTradeGoods

public boolean isTradeGoods()
Get the TradeGoods value.

Returns:
a boolean value

isLibertyGoodsType

public boolean isLibertyGoodsType()
Whether this type of goods produces liberty points.

Returns:
a boolean value

isImmigrationGoodsType

public boolean isImmigrationGoodsType()
Whether this type of goods causes immigration.

Returns:
a boolean value

getBreedingNumber

public int getBreedingNumber()
Get the BreedingNumber value.

Returns:
an int value

setBreedingNumber

public void setBreedingNumber(int newBreedingNumber)
Set the BreedingNumber value.

Parameters:
newBreedingNumber - The new BreedingNumber value.

isBreedable

public boolean isBreedable()
Returns true if this type of Goods is breedable. This should only be true for animals, such as horses.

Returns:
a boolean value

getPrice

public int getPrice()
Get the Price value.

Returns:
an int value

setPrice

public void setPrice(int newPrice)
Set the Price value.

Parameters:
newPrice - The new Price value.

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
Makes an XML-representation of this object.

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

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.

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in)
                       throws javax.xml.stream.XMLStreamException
Reads the attributes of this object from an XML stream.

Overrides:
readAttributes in class FreeColGameObjectType
Parameters:
in - The XML input stream.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

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

getXMLElementTagName

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

Returns:
"goods-type".