net.sf.freecol.common.model
Class TileItem

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObject
          extended by net.sf.freecol.common.model.TileItem
All Implemented Interfaces:
Locatable
Direct Known Subclasses:
LostCityRumour, Resource, TileImprovement

public abstract class TileItem
extends FreeColGameObject
implements Locatable

Represents a TileItem item on a Tile.


Field Summary
static int RESOURCE_ZINDEX
           
static int RUMOUR_ZINDEX
           
protected  Tile tile
           
 
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
TileItem(Game game, java.lang.String id)
          Initiates a new TileItem with the given ID.
TileItem(Game game, Tile tile)
          Creates a new TileItem.
TileItem(Game game, javax.xml.stream.XMLStreamReader in)
          Initiates a new TileItem from an XML stream.
 
Method Summary
 Location getLocation()
          Gets the location of this TileItem.
 int getSpaceTaken()
          TileItems do not take any space, and cannot be taken carried.
 Tile getTile()
          Returns the Tile where this TileItem is located, or null if it's location is Europe.
abstract  int getZIndex()
          Get the ZIndex value.
abstract  boolean isTileTypeAllowed(TileType tileType)
          Returns true if the TileItem is compatible with the given TileType.
 void setLocation(Location newLocation)
          Sets the location for this TileItem.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
dispose, disposeList, 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 net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readAttributes, readAttributes, readChild, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setSpecification, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE_ZINDEX

public static final int RESOURCE_ZINDEX
See Also:
Constant Field Values

RUMOUR_ZINDEX

public static final int RUMOUR_ZINDEX
See Also:
Constant Field Values

tile

protected Tile tile
Constructor Detail

TileItem

public TileItem(Game game,
                Tile tile)
Creates a new TileItem.

Parameters:
game - The Game in which this object belong.
tile - The location of the Settlement.

TileItem

public TileItem(Game game,
                javax.xml.stream.XMLStreamReader in)
         throws javax.xml.stream.XMLStreamException
Initiates a new TileItem from an XML stream.

Parameters:
game - The Game in which this object belong.
in - The input stream containing the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

TileItem

public TileItem(Game game,
                java.lang.String id)
Initiates a new TileItem with the given ID. The object should later be initialized by calling either FreeColGameObject.readFromXML(XMLStreamReader).

Parameters:
game - The Game in which this object belong.
id - The unique identifier for this object.
Method Detail

setLocation

public void setLocation(Location newLocation)
Sets the location for this TileItem.

Specified by:
setLocation in interface Locatable
Parameters:
newLocation - The new Location for the TileItem.

getLocation

public Location getLocation()
Gets the location of this TileItem.

Specified by:
getLocation in interface Locatable
Returns:
The location of this TileItem.

getTile

public Tile getTile()
Returns the Tile where this TileItem is located, or null if it's location is Europe.

Specified by:
getTile in interface Locatable
Returns:
The Tile where this TileItem is located. Or null if its location is Europe.

getSpaceTaken

public int getSpaceTaken()
TileItems do not take any space, and cannot be taken carried.

Specified by:
getSpaceTaken in interface Locatable
Returns:
Always 0.

getZIndex

public abstract int getZIndex()
Get the ZIndex value.

Returns:
an int value

isTileTypeAllowed

public abstract boolean isTileTypeAllowed(TileType tileType)
Returns true if the TileItem is compatible with the given TileType.

Parameters:
tileType - a TileType value
Returns:
a boolean value