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
           
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
TileItem(Game game, org.w3c.dom.Element e)
          Initiates a new TileItem from an Element.
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 Element.
 
Method Summary
 void dispose()
          Disposes this TileItem.
 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.
 void setLocation(Location newLocation)
          Sets the location for this TileItem.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
addToRemoveElement, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, getXMLElementTagName, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toString, toXML, updateFreeColGameObject, updateID
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
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
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 Element.

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,
                org.w3c.dom.Element e)
Initiates a new TileItem from an Element.

Parameters:
game - The Game in which this object belong.
e - An XML-element that will be used to initialize this object.

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) or FreeColObject.readFromXMLElement(Element).

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

dispose

public void dispose()
Disposes this TileItem.

Overrides:
dispose in class FreeColGameObject