|
|||||||||
| 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.AbstractGoods
net.sf.freecol.common.model.Goods
public class Goods
Represents locatable goods of a specified type and amount. Use AbstractGoods to represent abstract or potential goods that need not be present in any particular location.
AbstractGoods| Field Summary | |
|---|---|
static GoodsType |
BELLS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
CIGARS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
CLOTH
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
COATS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
COTTON
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
CROSSES
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
FISH
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
FOOD
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
FURS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
private Game |
game
|
static GoodsType |
HAMMERS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
HORSES
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
private Location |
location
|
private static java.util.logging.Logger |
logger
|
static GoodsType |
LUMBER
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
MUSKETS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
ORE
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
RUM
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
SILVER
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
SUGAR
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
TOBACCO
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
TOOLS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
static GoodsType |
TRADEGOODS
Need to change various classes to use the specification in order to remove reliance on these static quick links. |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE |
| Constructor Summary | |
|---|---|
Goods(Game game,
org.w3c.dom.Element e)
Creates a new Goods instance. |
|
Goods(Game game,
Location location,
GoodsType type,
int amount)
Creates a standard Goods-instance given the place where
the goods is. |
|
Goods(Game game,
javax.xml.stream.XMLStreamReader in)
Creates a new Goods instance. |
|
| Method Summary | |
|---|---|
void |
adjustAmount()
If the amount of goods is greater than the container can hold, then this method adjusts the amount to the maximum amount possible. |
Game |
getGame()
Gets the game object this Goods belongs to. |
Location |
getLocation()
Gets the location of this goods. |
Player |
getOwner()
Gets the owner of this Ownable. |
int |
getSpaceTaken()
Gets the amount of space this Goods take. |
Tile |
getTile()
Returns the Tile where this Goods is located,
or null if it's location is Europe. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
static void |
initialize(java.util.List<GoodsType> goodsList,
int numberOfTypes)
Initializes the important Types for quick reference - performed by Specification.java Should be softcoded as much as possible, and this should be amended later |
void |
loadOnto(Unit carrier)
Loads the cargo onto a carrier that is on the same tile. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
setLocation(Location location)
Sets the location of the goods. |
void |
setOwner(Player p)
Sets the owner of this Ownable. |
java.lang.String |
toString()
Returns a textual representation of this object. |
static java.lang.String |
toString(Goods goods)
|
static java.lang.String |
toString(GoodsType goodsType,
int amount)
|
void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
void |
unload()
Unload this Goods from a carrier into a colony. |
| Methods inherited from class net.sf.freecol.common.model.AbstractGoods |
|---|
getAmount, getType, setAmount, setType |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.model.Typed |
|---|
getType |
| Field Detail |
|---|
private static java.util.logging.Logger logger
public static GoodsType FOOD
public static GoodsType LUMBER
public static GoodsType ORE
public static GoodsType SILVER
public static GoodsType HORSES
public static GoodsType RUM
public static GoodsType CIGARS
public static GoodsType CLOTH
public static GoodsType COATS
public static GoodsType TRADEGOODS
public static GoodsType TOOLS
public static GoodsType MUSKETS
public static GoodsType FISH
public static GoodsType BELLS
public static GoodsType CROSSES
public static GoodsType HAMMERS
public static GoodsType SUGAR
public static GoodsType TOBACCO
public static GoodsType FURS
public static GoodsType COTTON
private Game game
private Location location
| Constructor Detail |
|---|
public Goods(Game game,
Location location,
GoodsType type,
int amount)
Goods-instance given the place where
the goods is.
This constructor only asserts that the game and
that the location (if given) can store goods. The goods will not
be added to the location (use Location.add for this).
game - The Game in which this object belongslocation - The location of the goods (may be null)type - The type of the goods.amount - The amount of the goods.
java.lang.IllegalArgumentException - if the location cannot store any goods.
public Goods(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
Goods instance.
game - a Game valuein - a XMLStreamReader value
javax.xml.stream.XMLStreamException - if an error occurs
public Goods(Game game,
org.w3c.dom.Element e)
Goods instance.
game - a Game valuee - an Element value| Method Detail |
|---|
public static void initialize(java.util.List<GoodsType> goodsList,
int numberOfTypes)
numberOfTypes - Initializer for NUMBER_OF_TYPESpublic Player getOwner()
Ownable.
getOwner in interface OwnablePlayer controlling this
Ownable.public void setOwner(Player p)
Ownable.
setOwner in interface Ownablep - The Player that should take ownership
of this Ownable.
java.lang.UnsupportedOperationException - is always thrown by
this method.public java.lang.String toString()
toString in class AbstractGoodsString with the format:
public static java.lang.String toString(Goods goods)
public static java.lang.String toString(GoodsType goodsType,
int amount)
public Tile getTile()
Tile where this Goods is located,
or null if it's location is Europe.
getTile in interface Locatablepublic void setLocation(Location location)
setLocation in interface Locatablelocation - The new location of the goods,public Location getLocation()
getLocation in interface Locatablepublic int getSpaceTaken()
Goods take.
getSpaceTaken in interface Locatablepublic void adjustAmount()
public void loadOnto(Unit carrier)
carrier - The carrier onto which to the load the goods.
java.lang.IllegalStateException - If the carrier is on another tile than
this unit, the location of the goods is null or both
carriers are not in port in Europe.public void unload()
java.lang.IllegalStateException - If the goods are not on a unit or the unit not in a colony.public Game getGame()
Goods belongs to.
Game.
public void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class AbstractGoodsout - The target stream.
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 AbstractGoodsin - 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 | ||||||||