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
           
static int NO_BREEDING
           
static int NO_PRICE
           
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.FreeColGameObjectType
featureContainer
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE
 
Constructor Summary
GoodsType(int index)
           
 
Method Summary
 int getBreedingNumber()
          Get the BreedingNumber value.
 int getInitialAmount()
           
 int getInitialBuyPrice()
           
 int getInitialSellPrice()
           
 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()
           
 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()
           
 void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void readChildren(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 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.
 void setTradeGoods(boolean newTradeGoods)
          Set the TradeGoods value.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, getFeatureContainer, getIndex, getModifierSet, hasAbility, hasAbility, readChild, readFromXML, readFromXMLImpl, setFeatureContainer, setIndex, toString, toXMLImpl
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getXMLElementTagName, hasAttribute, hasListeners, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, setId, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_BREEDING

public static final int NO_BREEDING
See Also:
Constant Field Values

NO_PRICE

public static final int NO_PRICE
See Also:
Constant Field Values

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(int index)
Method Detail

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()

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

setTradeGoods

public void setTradeGoods(boolean newTradeGoods)
Set the TradeGoods value.

Parameters:
newTradeGoods - The new TradeGoods 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.

readAttributes

public void readAttributes(javax.xml.stream.XMLStreamReader in,
                           Specification specification)
                    throws javax.xml.stream.XMLStreamException
Overrides:
readAttributes in class FreeColGameObjectType
Throws:
javax.xml.stream.XMLStreamException

readChildren

public void readChildren(javax.xml.stream.XMLStreamReader in,
                         Specification specification)
                  throws javax.xml.stream.XMLStreamException
Overrides:
readChildren in class FreeColGameObjectType
Throws:
javax.xml.stream.XMLStreamException