Package net.sf.freecol.server.model
Class ServerBuilding
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Comparable<FreeColObject>
,Consumer
,Location
,Named
,Ownable
,ObjectWithId
,TurnTaker
public class ServerBuilding extends Building implements TurnTaker
The server version of a building.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.freecol.common.model.WorkLocation
WorkLocation.Suggestion
-
Nested classes/interfaces inherited from class net.sf.freecol.common.model.UnitLocation
UnitLocation.NoAddReason
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
-
Fields inherited from class net.sf.freecol.common.model.Building
buildingType, TAG, UNIT_CHANGE
-
Fields inherited from class net.sf.freecol.common.model.WorkLocation
colony, EMPTY_LIST
-
Fields inherited from class net.sf.freecol.common.model.FreeColGameObject
initialized
-
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE_TAG, DEFAULT_CLASS_INDEX, fcoComparator, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE_TAG, VALUE_TAG
-
Fields inherited from interface net.sf.freecol.common.model.Consumer
BUILDING_PRIORITY, COLONY_PRIORITY, COMPARATOR, POPULATION_PRIORITY, UNIT_PRIORITY
-
Fields inherited from interface net.sf.freecol.common.model.Location
LOCATION_RANK_EUROPE, LOCATION_RANK_HIGHSEAS, LOCATION_RANK_NOWHERE
-
-
Constructor Summary
Constructors Constructor Description ServerBuilding(Game game, java.lang.String id)
Trivial constructor for Game.newInstance.ServerBuilding(Game game, Colony colony, BuildingType type)
Creates a new ServerBuilding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
csAssignStudent(Unit teacher, ChangeSet cs)
Assigns a student to a teacher within a building.void
csCheckMissingInput(ProductionInfo pi, ChangeSet cs)
Check a building to see if it is missing input.boolean
csCheckTeach(Unit teacher, ChangeSet cs)
Check and complete teaching if possible.void
csNewTurn(java.util.Random random, LogBuilder lb, ChangeSet cs)
New turn for this building.private void
csRepairUnits(ChangeSet cs)
Repair the units in this building.private void
csTeach(ChangeSet cs)
Teach all the units in this school.private boolean
csTrainStudent(Unit teacher, Unit student, ChangeSet cs)
Train a student.-
Methods inherited from class net.sf.freecol.common.model.Building
canAddType, canAutoProduce, canBeDamaged, canBuildNext, canProduce, copyIn, downgrade, evaluateFor, getAbilities, getAdjustedProductionInfo, getAvailableProductionTypes, getBaseProduction, getCompetenceFactor, getCompetenceModifiers, getConsumedGoods, getConsumptionModifiers, getDisplayObject, getLabel, getLevel, getLocationLabel, getModifiers, getNameKey, getNoAddReason, getNoWorkReason, getPriority, getProductionModifiers, getRebelFactor, getType, getUnitCapacity, getWorkTile, getXMLTagName, goodSuggestionCheck, isAvailable, isCurrent, readAttributes, toShortString, toString, up, upgrade, writeAttributes
-
Methods inherited from class net.sf.freecol.common.model.WorkLocation
add, canBeWorked, canTeach, getBestProductionType, getClaimTemplate, getColony, getCurrentWorkType, getExpertUnitType, getGenericPotential, getInputs, getLocationLabelFor, getMaximumProductionOf, getOccupation, getOccupation, getOutputs, getOwner, getPotentialProduction, getProduction, getProductionDeficit, getProductionInfo, getProductionOf, getProductionType, getRank, getSettlement, getSuggestions, getTile, getTotalProductionOf, getUnitProduction, getWorkFor, goodSuggestionCheck, hasInputs, hasOutputs, produces, readChild, remove, setColony, setOwner, setProductionType, setWorkFor, updateProductionType, writeChildren
-
Methods inherited from class net.sf.freecol.common.model.UnitLocation
canAdd, clearUnitList, contains, disposeResources, equipForRole, getCarrierForUnit, getDisposables, getFirstUnit, getGoodsContainer, getIndianSettlement, getLastUnit, getNavalUnits, getSpaceTaken, getTotalUnitCount, getUnitCount, getUnitList, getUnits, hasCarrierWithSpace, intern, isEmpty, isFull, moveToFront, priceGoods, readChildren
-
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
checkIntegrity, dispose, equals, fundamentalDispose, getClassIndex, getGame, getLinkTarget, getSpecification, hashCode, internId, isDisposed, isInitialized, isInternable, readFromXML, setGame, setSpecification
-
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addAbility, addFeatures, addModifier, addPropertyChangeListener, addPropertyChangeListener, apply, apply, applyModifiers, applyModifiers, arrayKey, compareIds, compareTo, containsAbilityKey, containsModifierKey, copy, copy, copy, copy, copyInCast, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAbilities, getAbilities, getAbilities, getDefenceModifiers, getFeatureContainer, getFreeColObjectClass, getFreeColObjectClassByName, getId, getIdNumber, getIdType, getIdTypeByName, getModifiers, getModifiers, getModifiers, getObjectClassIndex, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getSortedAbilities, getSortedModifiers, getSuffix, getSuffix, hasAbility, hasAbility, hasAbility, hasListeners, hasModifier, hasModifier, hasModifier, idEquals, invokeMethod, logFreeColObjects, readFromXMLPartial, removeAbilities, removeAbility, removeFeatures, removeModifier, removeModifiers, removePropertyChangeListener, removePropertyChangeListener, save, save, save, save, serialize, serialize, serialize, serialize, setId, toXML, toXML, toXMLPartial, toXMLPartial
-
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, getLocationImageKey
-
-
-
-
Constructor Detail
-
ServerBuilding
public ServerBuilding(Game game, java.lang.String id)
Trivial constructor for Game.newInstance.- Parameters:
game
- TheGame
this object belongs to.id
- The object identifier.
-
ServerBuilding
public ServerBuilding(Game game, Colony colony, BuildingType type)
Creates a new ServerBuilding.- Parameters:
game
- TheGame
this object belongs to.colony
- TheColony
in which this building is located.type
- TheBuildingType
of building.
-
-
Method Detail
-
csTeach
private void csTeach(ChangeSet cs)
Teach all the units in this school.- Parameters:
cs
- AChangeSet
to update.
-
csCheckTeach
public boolean csCheckTeach(Unit teacher, ChangeSet cs)
Check and complete teaching if possible. This needs to be separate and public because of the recheck of teaching required if the colony production bonus rises at end of new turn calculations.- Parameters:
teacher
- The teachingUnit
.cs
- AChangeSet
to update.- Returns:
- True if teaching occurred.
-
csTrainStudent
private boolean csTrainStudent(Unit teacher, Unit student, ChangeSet cs)
Train a student.- Parameters:
teacher
- The teacherUnit
.student
- The studentUnit
to train.cs
- AChangeSet
to update.- Returns:
- True if teaching occurred.
-
csAssignStudent
private boolean csAssignStudent(Unit teacher, ChangeSet cs)
Assigns a student to a teacher within a building.- Parameters:
teacher
- TheUnit
that is teaching.cs
- AChangeSet
to update.- Returns:
- True if a student was assigned.
-
csRepairUnits
private void csRepairUnits(ChangeSet cs)
Repair the units in this building.- Parameters:
cs
- AChangeSet
to update.
-
csCheckMissingInput
public void csCheckMissingInput(ProductionInfo pi, ChangeSet cs)
Check a building to see if it is missing input. The building must need input, have a person working there, and have no production occurring.- Parameters:
pi
- TheProductionInfo
for the building.cs
- AChangeSet
to update.
-
csNewTurn
public void csNewTurn(java.util.Random random, LogBuilder lb, ChangeSet cs)
New turn for this building.
-
-