net.sf.freecol.common.model
Class PlayerExploredTile

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.PlayerExploredTile

public class PlayerExploredTile
extends FreeColGameObject

This class contains the mutable tile data visible to a specific player.

Sometimes a tile contains information that should not be given to a player. For instance; a settlement that was built after the player last viewed the tile.

The toXMLElement of Tile uses information from this class to hide information that is not available.


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
PlayerExploredTile(Game game, Player player, Tile tile)
          Creates a new PlayerExploredTile.
PlayerExploredTile(Game game, javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 
Method Summary
 int getColonyStockadeLevel()
           
 int getColonyUnitCount()
           
 java.util.List<TileImprovement> getImprovements()
           
 LostCityRumour getLostCityRumour()
           
 Unit getMissionary()
           
 Player getOwner()
           
 Player getPlayer()
          Gets the Player owning this object (not the Tile).
 Resource getResource()
           
 TileImprovement getRiver()
           
 TileImprovement getRoad()
           
 UnitType getSkill()
           
 void getTileItemInfo(TileItemContainer tic)
          Copies given TileItemContainer
 GoodsType[] getWantedGoods()
           
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 boolean hasBeenVisited()
           
 boolean hasLostCityRumour()
           
 boolean hasRiver()
           
 boolean hasRoad()
           
 boolean isConnected()
           
 boolean isExplored()
          Checks if this Tile has been explored.
 void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setColonyStockadeLevel(int colonyStockadeLevel)
           
 void setColonyUnitCount(int colonyUnitCount)
           
 void setConnected(boolean connected)
           
 void setExplored(boolean explored)
           
 void setLostCityRumour(LostCityRumour lostCityRumour)
           
 void setMissionary(Unit missionary)
           
 void setOwner(Player owner)
           
 void setSkill(UnitType newSkill)
           
 void setVisited()
           
 void setWantedGoods(GoodsType[] newWantedGoods)
           
 void toXMLImpl(javax.xml.stream.XMLStreamWriter out, Player player, boolean showAll, boolean toSavedGame)
          This method writes an XML-representation of this object to the given stream.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
addToRemoveElement, dispose, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, 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
 

Constructor Detail

PlayerExploredTile

public PlayerExploredTile(Game game,
                          Player player,
                          Tile tile)
Creates a new PlayerExploredTile.

Parameters:
player - the player
tile - a tile

PlayerExploredTile

public PlayerExploredTile(Game game,
                          javax.xml.stream.XMLStreamReader in)
                   throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Parameters:
in - The XML stream to read the data from.
Throws:
javax.xml.stream.XMLStreamException - if an error occurred during parsing.
Method Detail

getTileItemInfo

public void getTileItemInfo(TileItemContainer tic)
Copies given TileItemContainer

Parameters:
tic - The TileItemContainer to copy from

setColonyUnitCount

public void setColonyUnitCount(int colonyUnitCount)

getColonyUnitCount

public int getColonyUnitCount()

setColonyStockadeLevel

public void setColonyStockadeLevel(int colonyStockadeLevel)

getColonyStockadeLevel

public int getColonyStockadeLevel()

hasRoad

public boolean hasRoad()

getRoad

public TileImprovement getRoad()

hasRiver

public boolean hasRiver()

getRiver

public TileImprovement getRiver()

getResource

public Resource getResource()

getLostCityRumour

public LostCityRumour getLostCityRumour()

getImprovements

public java.util.List<TileImprovement> getImprovements()

setLostCityRumour

public void setLostCityRumour(LostCityRumour lostCityRumour)

hasLostCityRumour

public boolean hasLostCityRumour()

setConnected

public void setConnected(boolean connected)

isConnected

public boolean isConnected()

setExplored

public void setExplored(boolean explored)

isExplored

public boolean isExplored()
Checks if this Tile has been explored.

Returns:
true if the tile has been explored.

setSkill

public void setSkill(UnitType newSkill)

getSkill

public UnitType getSkill()

setOwner

public void setOwner(Player owner)

getOwner

public Player getOwner()

setWantedGoods

public void setWantedGoods(GoodsType[] newWantedGoods)

getWantedGoods

public GoodsType[] getWantedGoods()

setMissionary

public void setMissionary(Unit missionary)

getMissionary

public Unit getMissionary()

setVisited

public void setVisited()

hasBeenVisited

public boolean hasBeenVisited()

getPlayer

public Player getPlayer()
Gets the Player owning this object (not the Tile).

Returns:
The Player of this PlayerExploredTile.

toXMLImpl

public void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
                      Player player,
                      boolean showAll,
                      boolean toSavedGame)
               throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Only attributes visible to the given Player will be added to that representation if showAll is set to false.

Parameters:
out - The target stream.
player - The Player this XML-representation should be made for, or null if showAll == true.
showAll - Only attributes visible to player will be added to the representation if showAll is set to false.
toSavedGame - If true then information that is only needed when saving a game is added.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

public void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                     throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if an error occurred during parsing.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
"playerExploredTile".