|
||||||||||
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.TileItem
net.sf.freecol.common.model.Resource
public class Resource
Represents a locatable goods of a specified type and quantity.
Field Summary |
---|
Fields inherited from class net.sf.freecol.common.model.TileItem |
---|
RESOURCE_ZINDEX, RUMOUR_ZINDEX |
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
Resource(Game game,
org.w3c.dom.Element e)
|
|
Resource(Game game,
Tile tile,
ResourceType type)
Creates a standard Resource -instance. |
|
Resource(Game game,
javax.xml.stream.XMLStreamReader in)
|
Method Summary | |
---|---|
void |
dispose()
Disposes this resource. |
GoodsType |
getBestGoodsType()
Returns the best GoodsType |
int |
getBonus(GoodsType goodsType,
UnitType unitType,
int potential)
Returns the bonus (checking available stock) for next turn. |
java.lang.String |
getOutputString()
Returns a String with the output of this Resource. |
int |
getQuantity()
Returns the current quantity. |
ResourceType |
getType()
Returns the ResourceType of this Resource. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
int |
getZIndex()
Get the ZIndex value. |
void |
setName(java.lang.String newName)
|
void |
setQuantity(int newQuantity)
Returns the current quantity. |
java.lang.String |
toString()
Returns a textual representation of this object. |
int |
useQuantity(GoodsType goodsType,
UnitType unitType,
int potential)
Reduces the available quantity by the bonus output of GoodsType . |
int |
useQuantity(int usedQuantity)
Reduces the value quantity . |
Methods inherited from class net.sf.freecol.common.model.TileItem |
---|
getLocation, getSpaceTaken, getTile, setLocation |
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
---|
addToRemoveElement, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toXML, updateFreeColGameObject, updateID |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Resource(Game game, Tile tile, ResourceType type)
Resource
-instance.
This constructor asserts that the game, tile and type are valid.
game
- The Game
in which this object belongs.tile
- The Tile
on which this object sits.type
- The ResourceType
of this Resource.public Resource(Game game, javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public Resource(Game game, org.w3c.dom.Element e)
Method Detail |
---|
public java.lang.String toString()
toString
in class FreeColGameObject
String
of either:
public ResourceType getType()
ResourceType
of this Resource.
getType
in interface Typed<ResourceType>
public java.lang.String getOutputString()
String
with the output of this Resource.
public int getQuantity()
public void setQuantity(int newQuantity)
public final int getZIndex()
ZIndex
value.
getZIndex
in class TileItem
int
valuepublic GoodsType getBestGoodsType()
public int getBonus(GoodsType goodsType, UnitType unitType, int potential)
goodsType
- The GoodsType to checkunitType
- an UnitType
valuepotential
- Potential of Tile + Improvements
int
valuepublic int useQuantity(GoodsType goodsType, UnitType unitType, int potential)
GoodsType
.
goodsType
- The GoodsType to checkunitType
- an UnitType
valuepotential
- Potential of Tile + Improvements
int
valuepublic int useQuantity(int usedQuantity)
quantity
.
usedQuantity
- The quantity that was used up.
public void dispose()
dispose
in class TileItem
public static java.lang.String getXMLElementTagName()
public void setName(java.lang.String newName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |