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  java.lang.String colonyStockadeKey
           
private  int colonyUnitCount
           
private static java.util.logging.Logger logger
           
private  Unit missionary
           
private  Player owner
           
private  Settlement owningSettlement
           
private  Player player
           
private  UnitType skill
           
private  Tile tile
           
private  java.util.List<TileItem> tileItems
           
private  GoodsType[] wantedGoods
           
 
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
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
 java.util.List<TileItem> getAllTileItems()
           
 java.lang.String getColonyStockadeKey()
           
 int getColonyUnitCount()
           
 Unit getMissionary()
           
 Player getOwner()
           
 Settlement getOwningSettlement()
           
 UnitType getSkill()
           
 GoodsType[] getWantedGoods()
           
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setColonyStockadeKey(java.lang.String colonyStockadeKey)
           
 void setColonyUnitCount(int colonyUnitCount)
           
 void setMissionary(Unit missionary)
           
 void setOwner(Player owner)
           
 void setOwningSettlement(Settlement owningSettlement)
           
 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.
 void update(boolean full)
          Update this PlayerExploredTile with the current state of its tile.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
dispose, disposeList, equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toString, toXML, 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, 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

logger

private static final java.util.logging.Logger logger

player

private Player player

tile

private Tile tile

owner

private Player owner

owningSettlement

private Settlement owningSettlement

tileItems

private final java.util.List<TileItem> tileItems

colonyUnitCount

private int colonyUnitCount

colonyStockadeKey

private java.lang.String colonyStockadeKey

skill

private UnitType skill

wantedGoods

private GoodsType[] wantedGoods

missionary

private Unit missionary
Constructor Detail

PlayerExploredTile

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

Parameters:
player - The Player that owns this view.
tile - The Tile to view.

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

update

public void update(boolean full)
Update this PlayerExploredTile with the current state of its tile.

Parameters:
full - If true, update information hidden by settlements.

getOwner

public Player getOwner()

getOwningSettlement

public Settlement getOwningSettlement()

getAllTileItems

public java.util.List<TileItem> getAllTileItems()

getColonyUnitCount

public int getColonyUnitCount()

getColonyStockadeKey

public java.lang.String getColonyStockadeKey()

getMissionary

public Unit getMissionary()

getSkill

public UnitType getSkill()

getWantedGoods

public GoodsType[] getWantedGoods()

setOwner

public void setOwner(Player owner)

setOwningSettlement

public void setOwningSettlement(Settlement owningSettlement)

setColonyUnitCount

public void setColonyUnitCount(int colonyUnitCount)

setColonyStockadeKey

public void setColonyStockadeKey(java.lang.String colonyStockadeKey)

setMissionary

public void setMissionary(Unit missionary)

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