|
||||||||||
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.TileItemContainer
public class TileItemContainer
Contains TileItem
s and can be used by a Tile
to make certain tasks easier.
Field Summary |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
TileItemContainer(Game game,
Tile tile)
Creates an empty TileItemContainer . |
|
TileItemContainer(Game game,
Tile tile,
org.w3c.dom.Element e)
Initiates a new TileItemContainer from an Element . |
|
TileItemContainer(Game game,
Tile tile,
javax.xml.stream.XMLStreamReader in)
Initiates a new TileItemContainer from an Element . |
Method Summary | |
---|---|
TileImprovement |
addRiver(int magnitude,
int style)
Creates a river TileImprovement and adds to this Tile/Container. |
TileItem |
addTileItem(TileItem item)
Adds a TileItem to this container. |
void |
clear()
|
TileItemContainer |
clone()
Clone functions for making a clone of this TileItemContainer |
TileItemContainer |
clone(boolean importBonuses)
|
TileItemContainer |
clone(boolean importBonuses,
boolean copyOnlyNatural)
|
boolean |
contains(TileItem t)
Checks if the specified TileItem is in this container. |
void |
copyFrom(TileItemContainer tic)
|
void |
copyFrom(TileItemContainer tic,
boolean importResources)
|
void |
copyFrom(TileItemContainer tic,
boolean importResources,
boolean copyOnlyNatural)
|
void |
dispose()
Removes all references to this object. |
TileImprovement |
findTileImprovementType(TileImprovementType type)
Checks if a TileImprovement of this Type is already in this container. |
java.util.List<TileImprovement> |
getCompletedImprovements()
Returns a List of the completed
TileImprovement s in this
TileItemContainer . |
java.util.List<TileImprovement> |
getImprovements()
Returns a List of the TileImprovement s
in this TileItemContainer . |
LostCityRumour |
getLostCityRumour()
Get the LostCityRumour value. |
int |
getMoveCost(int basicMoveCost,
Tile fromTile)
Determine the movement cost to this Tile from another Tile . |
java.util.Set<Modifier> |
getProductionBonus(GoodsType goodsType,
UnitType unitType)
Describe getProductionBonus method here. |
Resource |
getResource()
|
TileImprovement |
getRiver()
|
TileImprovement |
getRoad()
|
Tile |
getTile()
|
java.util.List<TileItem> |
getTileItems()
Get the TileItems value. |
int |
getTotalBonusPotential(GoodsType g,
UnitType unitType,
int tilePotential)
Determine the total bonus for a GoodsType. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
hasImprovement(TileImprovementType type)
Will check whether this tile has a completed improvement of the given type. |
void |
removeAll()
Removes all TileItems. |
void |
removeAll(java.lang.Class c)
|
void |
removeIncompatibleImprovements()
Remove improvements incompatible with the given TileType. |
TileImprovement |
removeRiver()
Removes the river TileImprovement from this Tile/Container. |
TileItem |
removeTileItem(TileItem item)
Removes TileItem from this container. |
void |
setTileItems(java.util.List<TileItem> newTileItems)
Set the TileItems value. |
java.lang.String |
toString()
Creates a String representation of this
TileItemContainer . |
void |
toXML(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame,
PlayerExploredTile pet)
|
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 TileItemContainer(Game game, Tile tile)
TileItemContainer
.
game
- The Game
in which this TileItemContainer
belong.tile
- The Tile
this TileItemContainer
will be containg TileItems for.public TileItemContainer(Game game, Tile tile, javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
TileItemContainer
from an Element
.
game
- The Game
in which this TileItemContainer
belong.tile
- The Tile
using this TileItemContainer
for storing it's TileItem.in
- The input stream containing the XML.
javax.xml.stream.XMLStreamException
- if a problem was encountered
during parsing.public TileItemContainer(Game game, Tile tile, org.w3c.dom.Element e)
TileItemContainer
from an Element
.
game
- The Game
in which this TileItemContainer
belong.tile
- The Tile
using this TileItemContainer
for storing it's TileItem.e
- An XML-element that will be used to initialize
this object.Method Detail |
---|
public TileItemContainer clone()
clone
in class java.lang.Object
public TileItemContainer clone(boolean importBonuses)
public TileItemContainer clone(boolean importBonuses, boolean copyOnlyNatural)
public Tile getTile()
public final java.util.List<TileItem> getTileItems()
TileItems
value.
List
valuepublic final void setTileItems(java.util.List<TileItem> newTileItems)
TileItems
value.
newTileItems
- The new TileItems value.public Resource getResource()
public TileImprovement getRoad()
public TileImprovement getRiver()
public final LostCityRumour getLostCityRumour()
LostCityRumour
value.
LostCityRumour
valuepublic void clear()
public void removeIncompatibleImprovements()
public java.util.List<TileImprovement> getImprovements()
List
of the TileImprovement
s
in this TileItemContainer
.
List
.public java.util.List<TileImprovement> getCompletedImprovements()
List
of the completed
TileImprovement
s in this
TileItemContainer
.
List
.public int getTotalBonusPotential(GoodsType g, UnitType unitType, int tilePotential)
g
- a GoodsType
valueunitType
- an UnitType
valuetilePotential
- an int
value
public java.util.Set<Modifier> getProductionBonus(GoodsType goodsType, UnitType unitType)
getProductionBonus
method here.
goodsType
- a GoodsType
valueunitType
- a UnitType
value
Modifier
valuepublic int getMoveCost(int basicMoveCost, Tile fromTile)
Tile
from another Tile
.
Does not consider special unit abilities.
basicMoveCost
- an int
valuefromTile
- a Tile
value
public TileItem addTileItem(TileItem item)
TileItem
to this container.
item
- The TileItem to add to this container.
null
on errorpublic TileItem removeTileItem(TileItem item)
item
- The TileItem to remove from this container.
public void removeAll(java.lang.Class c)
public void copyFrom(TileItemContainer tic)
public void copyFrom(TileItemContainer tic, boolean importResources)
public void copyFrom(TileItemContainer tic, boolean importResources, boolean copyOnlyNatural)
public void removeAll()
public boolean contains(TileItem t)
TileItem
is in this container.
t
- The TileItem
to test the presence of.
public TileImprovement findTileImprovementType(TileImprovementType type)
type
- The TileImprovementType
to test the presence of.
public boolean hasImprovement(TileImprovementType type)
type
- The type to check for.
public void dispose()
dispose
in class FreeColGameObject
public TileImprovement addRiver(int magnitude, int style)
TileImprovement
and adds to this Tile/Container.
Checking for overwrite is done by addTileItem(net.sf.freecol.common.model.TileItem)
.
magnitude
- The Magnitude of the river to be createdstyle
- an int
value
public TileImprovement removeRiver()
TileImprovement
from this Tile/Container.
public void toXML(javax.xml.stream.XMLStreamWriter out, Player player, boolean showAll, boolean toSavedGame, PlayerExploredTile pet) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static java.lang.String getXMLElementTagName()
public java.lang.String toString()
String
representation of this
TileItemContainer
.
toString
in class FreeColGameObject
String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |