|
|||||||||
| 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.FreeColGameObject
net.sf.freecol.common.model.MarketData
public class MarketData
Objects of this class hold the market data for a particular type of good.
| Field Summary | |
|---|---|
private int |
amountInMarket
Amount of this goods in the market. |
private int |
arrears
Arrears owed to the crown. |
private int |
costToBuy
Purchase price. |
private GoodsType |
goodsType
What type of goods is this. |
private int |
incomeAfterTaxes
Total income after taxes. |
private int |
incomeBeforeTaxes
Total income before taxes. |
private int |
initialPrice
The initial price. |
private static java.util.logging.Logger |
logger
|
static int |
MAXIMUM_PRICE
|
static int |
MINIMUM_PRICE
Bounds on price movements. |
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
Sale price. |
private int |
sales
Total sales. |
private boolean |
traded
Has this good been traded? |
| Fields inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
UNITS_TAG_NAME |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
MarketData(Game game,
GoodsType goodsType)
Creates a new MarketData instance. |
|
MarketData(Game game,
java.lang.String id)
Instantiates a new MarketData with the given
ID. |
|
MarketData(Game game,
javax.xml.stream.XMLStreamReader in)
Instantiate a new MarketData from an
XML representation. |
|
| 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. |
void |
price()
Adjust the prices. |
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,
Player player,
boolean showAll,
boolean toSavedGame)
This method writes an XML-representation of this object to the given stream. |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
dispose, disposeList, equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toString, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int MINIMUM_PRICE
public static final int MAXIMUM_PRICE
private GoodsType goodsType
private int costToBuy
private int paidForSale
private int amountInMarket
private int initialPrice
private int arrears
private int sales
private int incomeBeforeTaxes
private int incomeAfterTaxes
private int oldPrice
private boolean traded
| Constructor Detail |
|---|
public MarketData(Game game,
GoodsType goodsType)
MarketData instance.
goodsType - a GoodsType value
public MarketData(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
MarketData from an
XML representation.
game - The Game this object belongs to.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if an error occured during parsing.
public MarketData(Game game,
java.lang.String id)
MarketData with the given
ID. The object should later be initialized by calling either
FreeColGameObject.readFromXML(XMLStreamReader) or
FreeColObject.readFromXMLElement(Element).
game - The Game in which this object belong.id - The unique identifier for this object.| Method Detail |
|---|
public void price()
public final GoodsType getGoodsType()
MarketData.
public final int getCostToBuy()
CostToBuy value.
int valuepublic final void setCostToBuy(int newCostToBuy)
CostToBuy value.
newCostToBuy - The new CostToBuy value.public final int getPaidForSale()
PaidForSale value.
int valuepublic final void setPaidForSale(int newPaidForSale)
PaidForSale value.
newPaidForSale - The new PaidForSale value.public final int getAmountInMarket()
AmountInMarket value.
int valuepublic final void setAmountInMarket(int newAmountInMarket)
AmountInMarket value.
newAmountInMarket - The new AmountInMarket value.public final int getInitialPrice()
InitialPrice value.
int valuepublic final void setInitialPrice(int newInitialPrice)
InitialPrice value.
newInitialPrice - The new InitialPrice value.public final int getArrears()
Arrears value.
int valuepublic final void setArrears(int newArrears)
Arrears value.
newArrears - The new Arrears value.public final int getSales()
Sales value.
int valuepublic final void setSales(int newSales)
Sales value.
newSales - The new Sales value.public final int getIncomeBeforeTaxes()
IncomeBeforeTaxes value.
int valuepublic final void setIncomeBeforeTaxes(int newIncomeBeforeTaxes)
IncomeBeforeTaxes value.
newIncomeBeforeTaxes - The new IncomeBeforeTaxes value.public final int getIncomeAfterTaxes()
IncomeAfterTaxes value.
int valuepublic final void setIncomeAfterTaxes(int newIncomeAfterTaxes)
IncomeAfterTaxes value.
newIncomeAfterTaxes - The new IncomeAfterTaxes value.public final int getOldPrice()
MarketData.
public void setOldPrice(int oldPrice)
MarketData.
oldPrice - A `new' old price.public final boolean getTraded()
MarketData?
public void setTraded(boolean traded)
MarketData.
traded - The trade status to set.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
Player will
be added to that representation if showAll is
set to false.
toXMLImpl in class FreeColGameObjectout - The target stream.player - The Player this XML-representation
should be made for, or null if
showAll == true.showAll - Only attributes visible to player
will be added to the representation if showAll
is set to false.toSavedGame - If true then information that
is only needed when saving a game is added.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||