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
private  int colonyStockadeLevel
           
private  int colonyUnitCount
           
private  boolean connected
           
private  boolean explored
           
private  java.util.List<TileImprovement> improvements
           
private static java.util.logging.Logger logger
           
private  LostCityRumour lostCityRumour
           
private  Unit missionary
           
private  Player owner
          The owner of this tile.
private  Player player
          The owner of this view.
private  Resource resource
           
private  TileImprovement river
           
private  TileImprovement road
           
private  boolean settlementVisited
           
private  UnitType skill
           
private  Tile tile
           
private  GoodsType[] wantedGoods
           
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE
 
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
addModelMessage, addModelMessage, addModelMessage, addToRemoveElement, dispose, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, readFromXMLPartialByClass, setFakeID, setGame, setId, toSavedXML, toString, toXML, toXMLImpl, toXMLPartialByClass, 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, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

player

private Player player
The owner of this view.


explored

private boolean explored

owner

private Player owner
The owner of this tile.


resource

private Resource resource

lostCityRumour

private LostCityRumour lostCityRumour

improvements

private java.util.List<TileImprovement> improvements

road

private TileImprovement road

river

private TileImprovement river

colonyUnitCount

private int colonyUnitCount

colonyStockadeLevel

private int colonyStockadeLevel

skill

private UnitType skill

wantedGoods

private GoodsType[] wantedGoods

settlementVisited

private boolean settlementVisited

missionary

private Unit missionary

connected

private boolean connected

tile

private Tile tile
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.

Specified by:
toXMLImpl in class FreeColGameObject
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.

Overrides:
readFromXMLImpl in class FreeColObject
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".