net.sf.freecol.server.model
Class ServerBuilding

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.UnitLocation
              extended by net.sf.freecol.common.model.WorkLocation
                  extended by net.sf.freecol.common.model.Building
                      extended by net.sf.freecol.server.model.ServerBuilding
All Implemented Interfaces:
java.lang.Comparable<Building>, Consumer, Location, Named, Ownable, ServerModelObject

public class ServerBuilding
extends Building
implements ServerModelObject

The server version of a building.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.freecol.common.model.UnitLocation
UnitLocation.NoAddReason
 
Field Summary
private static java.util.logging.Logger logger
           
 
Fields inherited from class net.sf.freecol.common.model.Building
buildingType, UNIT_CHANGE
 
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
 
Fields inherited from interface net.sf.freecol.common.model.Consumer
BUILDING_PRIORITY, COLONY_PRIORITY, COMPARATOR, POPULATION_PRIORITY, UNIT_PRIORITY
 
Constructor Summary
ServerBuilding(Game game, Colony colony, BuildingType type)
          Creates a new ServerBuilding.
ServerBuilding(Game game, java.lang.String id)
          Trivial constructor required for all ServerModelObjects.
 
Method Summary
private  boolean csAssignStudent(Unit teacher, ChangeSet cs)
          Assigns a student to a teacher within a building.
 void csNewTurn(java.util.Random random, ChangeSet cs)
          New turn for this building.
 java.lang.String getServerXMLElementTagName()
          Returns the tag name of the root element representing this object.
private  void repairUnits(ChangeSet cs)
           
private  void teach(ChangeSet cs, ServerPlayer owner)
           
 
Methods inherited from class net.sf.freecol.common.model.Building
add, canAdd, canAutoProduce, canBeDamaged, canBuildNext, compareTo, consumes, damage, getAdditionalProductionNextTurn, getConsumedGoods, getExpertUnitType, getGoodsInputType, getGoodsOutputType, getLevel, getLocationName, getMaximumProduction, getModifierSet, getNameKey, getNextNameKey, getNoAddReason, getNoWorkReason, getPotentialProduction, getPriority, getProduction, getProductionInfo, getProductionInfo, getProductionModifiers, getProductionOf, getProductionOf, getType, getUnitCapacity, getUnitProductivity, getXMLElementTagName, hasAbility, readFromXMLImpl, readFromXMLPartialImpl, remove, toString, toXMLImpl, toXMLPartialImpl, upgrade
 
Methods inherited from class net.sf.freecol.common.model.WorkLocation
canBeWorked, canTeach, getColony, getOwner, getSettlement, getTile, readAttributes, setColony, setOwner, writeAttributes
 
Methods inherited from class net.sf.freecol.common.model.UnitLocation
canAdd, contains, dispose, disposeList, getGoodsContainer, getLocationNameFor, getSpaceTaken, getUnitCount, getUnitIterator, getUnitList, isEmpty, isFull, readChild, readChildren, writeChildren
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, 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, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setSpecification, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeChildren
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.model.Location
getId
 

Field Detail

logger

private static final java.util.logging.Logger logger
Constructor Detail

ServerBuilding

public ServerBuilding(Game game,
                      java.lang.String id)
Trivial constructor required for all ServerModelObjects.


ServerBuilding

public ServerBuilding(Game game,
                      Colony colony,
                      BuildingType type)
Creates a new ServerBuilding.

Parameters:
game - The Game this object belongs to.
colony - The Colony in which this building is located.
type - The BuildingType of building.
Method Detail

csNewTurn

public void csNewTurn(java.util.Random random,
                      ChangeSet cs)
New turn for this building.

Specified by:
csNewTurn in interface ServerModelObject
Parameters:
random - A Random number source.
cs - A ChangeSet to update.

teach

private void teach(ChangeSet cs,
                   ServerPlayer owner)

csAssignStudent

private boolean csAssignStudent(Unit teacher,
                                ChangeSet cs)
Assigns a student to a teacher within a building.

Parameters:
teacher - The Unit that is teaching.
cs - A ChangeSet to update.

repairUnits

private void repairUnits(ChangeSet cs)

getServerXMLElementTagName

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

Specified by:
getServerXMLElementTagName in interface ServerModelObject
Returns:
"serverBuilding"