net.sf.freecol.common.model
Class MarketData

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.MarketData

public class MarketData
extends FreeColObject

Objects of this class hold the market data for a particular type of good.


Field Summary
private  int amountInMarket
          Describe amountInMarket here.
private  int arrears
          Describe arrears here.
private  int costToBuy
          Describe costToBuy here.
private  int incomeAfterTaxes
          Describe incomeAfterTaxes here.
private  int incomeBeforeTaxes
          Describe incomeBeforeTaxes here.
private  int initialPrice
          Describe initialPrice here.
private  int oldPrice
          Place to save to old price so as to be able to tell when a price change message should be generated.
private  int paidForSale
          Describe paidForSale here.
private  int sales
          Describe sales here.
private  boolean traded
          Has this good been traded?
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE
 
Constructor Summary
MarketData()
          Package constructor: This class is only supposed to be constructed by Market.
MarketData(GoodsType goodsType)
          Creates a new MarketData instance.
 
Method Summary
 int getAmountInMarket()
          Get the AmountInMarket value.
 int getArrears()
          Get the Arrears value.
 int getCostToBuy()
          Get the CostToBuy value.
 GoodsType getGoodsType()
          Get the type of goods of this MarketData.
 int getIncomeAfterTaxes()
          Get the IncomeAfterTaxes value.
 int getIncomeBeforeTaxes()
          Get the IncomeBeforeTaxes value.
 int getInitialPrice()
          Get the InitialPrice value.
 int getOldPrice()
          Get the old price in this MarketData.
 int getPaidForSale()
          Get the PaidForSale value.
 int getSales()
          Get the Sales value.
 boolean getTraded()
          Has there been trading in this MarketData?
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setAmountInMarket(int newAmountInMarket)
          Set the AmountInMarket value.
 void setArrears(int newArrears)
          Set the Arrears value.
 void setCostToBuy(int newCostToBuy)
          Set the CostToBuy value.
 void setIncomeAfterTaxes(int newIncomeAfterTaxes)
          Set the IncomeAfterTaxes value.
 void setIncomeBeforeTaxes(int newIncomeBeforeTaxes)
          Set the IncomeBeforeTaxes value.
 void setInitialPrice(int newInitialPrice)
          Set the InitialPrice value.
 void setOldPrice(int oldPrice)
          Set the old price in this MarketData.
 void setPaidForSale(int newPaidForSale)
          Set the PaidForSale value.
 void setSales(int newSales)
          Set the Sales value.
 void setTraded(boolean traded)
          Set the trade status of this MarketData.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
 
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, hasAbility, 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, toString, wait, wait, wait
 

Field Detail

costToBuy

private int costToBuy
Describe costToBuy here.


paidForSale

private int paidForSale
Describe paidForSale here.


amountInMarket

private int amountInMarket
Describe amountInMarket here.


initialPrice

private int initialPrice
Describe initialPrice here.


arrears

private int arrears
Describe arrears here.


sales

private int sales
Describe sales here.


incomeBeforeTaxes

private int incomeBeforeTaxes
Describe incomeBeforeTaxes here.


incomeAfterTaxes

private int incomeAfterTaxes
Describe incomeAfterTaxes here.


oldPrice

private int oldPrice
Place to save to old price so as to be able to tell when a price change message should be generated. Not necessary to serialize.


traded

private boolean traded
Has this good been traded?

Constructor Detail

MarketData

public MarketData()
Package constructor: This class is only supposed to be constructed by Market.


MarketData

public MarketData(GoodsType goodsType)
Creates a new MarketData instance.

Parameters:
goodsType - a GoodsType value
Method Detail

getCostToBuy

public final int getCostToBuy()
Get the CostToBuy value.

Returns:
an int value

setCostToBuy

public final void setCostToBuy(int newCostToBuy)
Set the CostToBuy value.

Parameters:
newCostToBuy - The new CostToBuy value.

getPaidForSale

public final int getPaidForSale()
Get the PaidForSale value.

Returns:
an int value

setPaidForSale

public final void setPaidForSale(int newPaidForSale)
Set the PaidForSale value.

Parameters:
newPaidForSale - The new PaidForSale value.

getAmountInMarket

public final int getAmountInMarket()
Get the AmountInMarket value.

Returns:
an int value

setAmountInMarket

public final void setAmountInMarket(int newAmountInMarket)
Set the AmountInMarket value.

Parameters:
newAmountInMarket - The new AmountInMarket value.

getInitialPrice

public final int getInitialPrice()
Get the InitialPrice value.

Returns:
an int value

setInitialPrice

public final void setInitialPrice(int newInitialPrice)
Set the InitialPrice value.

Parameters:
newInitialPrice - The new InitialPrice value.

getArrears

public final int getArrears()
Get the Arrears value.

Returns:
an int value

setArrears

public final void setArrears(int newArrears)
Set the Arrears value.

Parameters:
newArrears - The new Arrears value.

getSales

public final int getSales()
Get the Sales value.

Returns:
an int value

setSales

public final void setSales(int newSales)
Set the Sales value.

Parameters:
newSales - The new Sales value.

getIncomeBeforeTaxes

public final int getIncomeBeforeTaxes()
Get the IncomeBeforeTaxes value.

Returns:
an int value

setIncomeBeforeTaxes

public final void setIncomeBeforeTaxes(int newIncomeBeforeTaxes)
Set the IncomeBeforeTaxes value.

Parameters:
newIncomeBeforeTaxes - The new IncomeBeforeTaxes value.

getIncomeAfterTaxes

public final int getIncomeAfterTaxes()
Get the IncomeAfterTaxes value.

Returns:
an int value

setIncomeAfterTaxes

public final void setIncomeAfterTaxes(int newIncomeAfterTaxes)
Set the IncomeAfterTaxes value.

Parameters:
newIncomeAfterTaxes - The new IncomeAfterTaxes value.

getOldPrice

public final int getOldPrice()
Get the old price in this MarketData.

Returns:
The old price.

setOldPrice

public void setOldPrice(int oldPrice)
Set the old price in this MarketData.

Parameters:
oldPrice - A `new' old price.

getTraded

public final boolean getTraded()
Has there been trading in this MarketData?

Returns:
Whether trading has occurred.

setTraded

public void setTraded(boolean traded)
Set the trade status of this MarketData.

Parameters:
traded - The trade status to set.

getGoodsType

public final GoodsType getGoodsType()
Get the type of goods of this MarketData.

Returns:
The goods type for this data.

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  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 FreeColObject
Parameters:
out - The target stream.
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.

getXMLElementTagName

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

Returns:
the tag name.