|
|||||||||
| 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.UnitLocation
net.sf.freecol.common.model.GoodsLocation
public abstract class GoodsLocation
The GoodsLocation is a place where Units and
Goods can be put. The GoodsLocation can not store any other
Locatables, such as TileItems.
Locatable| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sf.freecol.common.model.UnitLocation |
|---|
UnitLocation.NoAddReason |
| Field Summary | |
|---|---|
private GoodsContainer |
goodsContainer
Describe goodsContainer here. |
private static java.util.logging.Logger |
logger
|
| 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 | |
|---|---|
protected |
GoodsLocation()
|
|
GoodsLocation(Game game)
Creates a new GoodsLocation instance. |
|
GoodsLocation(Game game,
java.lang.String id)
Creates a new GoodsLocation instance. |
|
GoodsLocation(Game game,
javax.xml.stream.XMLStreamReader in)
Creates a new GoodsLocation instance. |
| Method Summary | |
|---|---|
boolean |
add(Locatable locatable)
Adds a Locatable to this Location. |
boolean |
addGoods(AbstractGoods goods)
Describe addGoods method here. |
boolean |
addGoods(GoodsType type,
int amount)
Describe addGoods method here. |
boolean |
contains(Locatable locatable)
Checks if this Location contains the specified
Locatable. |
void |
dispose()
Dispose of this GoodsLocation. |
java.util.List<FreeColGameObject> |
disposeList()
Removes all references to this object. |
java.util.List<Goods> |
getCompactGoods()
Gets an List with every Goods in this
Colony. |
abstract int |
getGoodsCapacity()
Gets the maximum number of Goods this Location
can hold. |
GoodsContainer |
getGoodsContainer()
Gets the GoodsContainer this Location
use for storing it's goods, or null if the
Location cannot store any goods. |
int |
getGoodsCount(GoodsType type)
Gets the amount of one type of Goods at this Settlement. |
java.util.Iterator<Goods> |
getGoodsIterator()
Gets an Iterator of every Goods in this
GoodsContainer. |
UnitLocation.NoAddReason |
getNoAddReason(Locatable locatable)
Gets the reason why a given Locatable can not be
added to this Location. |
int |
getWarehouseCapacity()
Gets the storage capacity of this settlement. |
protected void |
readChild(javax.xml.stream.XMLStreamReader in)
Reads a single child object. |
boolean |
remove(Locatable locatable)
Removes a Locatable from this Location. |
Goods |
removeGoods(AbstractGoods goods)
Removes the given Goods from the Settlement. |
Goods |
removeGoods(GoodsType type)
Removes all Goods of the given type from the Settlement. |
Goods |
removeGoods(GoodsType type,
int amount)
Removes a specified amount of a type of Goods from this Settlement. |
void |
setGoodsContainer(GoodsContainer newGoodsContainer)
Set the GoodsContainer value. |
protected void |
writeChildren(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
Serialize the children of this UnitLocation, i.e. |
| Methods inherited from class net.sf.freecol.common.model.UnitLocation |
|---|
canAdd, getColony, getLocationName, getLocationNameFor, getSettlement, getSpaceTaken, getTile, getUnitCapacity, getUnitCount, getUnitIterator, getUnitList, isEmpty, isFull, readChildren, writeAttributes |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, getXMLElementTagName, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toString, toXML, toXMLImpl, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.model.Location |
|---|
getId |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private GoodsContainer goodsContainer
| Constructor Detail |
|---|
protected GoodsLocation()
public GoodsLocation(Game game)
GoodsLocation instance.
game - a Game value
public GoodsLocation(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
GoodsLocation instance.
game - a Game valuein - a XMLStreamReader value
javax.xml.stream.XMLStreamException - if an error occurs
public GoodsLocation(Game game,
java.lang.String id)
GoodsLocation instance.
game - a Game valueid - a String value| Method Detail |
|---|
public abstract int getGoodsCapacity()
Goods this Location
can hold.
public java.util.Iterator<Goods> getGoodsIterator()
Iterator of every Goods in this
GoodsContainer. Each Goods have a maximum
amount of GoodsContainer.CARGO_SIZE.
Iterator.public java.util.List<Goods> getCompactGoods()
List with every Goods in this
Colony. There is only one Goods for each
type of goods.
Iterator.public UnitLocation.NoAddReason getNoAddReason(Locatable locatable)
Locatable can not be
added to this Location.
getNoAddReason in class UnitLocationlocatable - The Locatable to test.
public boolean add(Locatable locatable)
Locatable to this Location.
add in interface Locationadd in class UnitLocationlocatable - The Locatable to add to this Location.public boolean remove(Locatable locatable)
Locatable from this Location.
remove in interface Locationremove in class UnitLocationlocatable - The Locatable to remove from this Location.public boolean contains(Locatable locatable)
Location contains the specified
Locatable.
contains in interface Locationcontains in class UnitLocationlocatable - The Locatable to test the presence of.
Locatable is
on this Location and
public final GoodsContainer getGoodsContainer()
GoodsContainer this Location
use for storing it's goods, or null if the
Location cannot store any goods.
getGoodsContainer in interface LocationgetGoodsContainer in class UnitLocationGoodsContainer valuepublic final void setGoodsContainer(GoodsContainer newGoodsContainer)
GoodsContainer value.
newGoodsContainer - The new GoodsContainer value.public int getWarehouseCapacity()
getGoodsCapacity()
public Goods removeGoods(GoodsType type,
int amount)
type - The type of Goods to remove from this settlement.amount - The amount of Goods to remove from this settlement.public Goods removeGoods(AbstractGoods goods)
goods - a Goods valuepublic Goods removeGoods(GoodsType type)
type - a GoodsType value
public boolean addGoods(GoodsType type,
int amount)
addGoods method here.
type - a GoodsType valueamount - an int valuepublic boolean addGoods(AbstractGoods goods)
addGoods method here.
goods - an AbstractGoods valuepublic int getGoodsCount(GoodsType type)
type - The type of goods to look for.
public java.util.List<FreeColGameObject> disposeList()
disposeList in class UnitLocationpublic void dispose()
dispose in class UnitLocation
protected void writeChildren(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
writeChildren in class UnitLocationout - a XMLStreamWriter valueplayer - a Player valueshowAll - a boolean valuetoSavedGame - a boolean value
javax.xml.stream.XMLStreamException - if an error occurs
protected void readChild(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readChild in class UnitLocationin - The XML input stream.
javax.xml.stream.XMLStreamException - if an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||