Class ShipyardState
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.city.impl.ShipyardState
-
-
Constructor Summary
Constructors Constructor Description ShipyardState(ICity city)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddShipBuildingOrder(IShipDueDate dueDate, java.util.Optional<TimedTask> task)Add an order for building a new ship to the list.voidaddShipRefitOrder(IShipDueDate dueDate, java.util.Optional<TimedTask> task)Add an order for refitting a ship to the list.voidaddShipRepairOrder(IShipDueDate dueDate, java.util.Optional<TimedTask> task)Add an order for repairing a ship to the list.intcalculateBuildTime(EShipType type)Calculate the build time for the ship of type.intcalculateConstructionCosts(EShipType type)Calculate the labor costs for building a new ship of the indicated type.intcalculateRefitCosts(EShipType type, int levels)Calculate the labor costs for the refit based on the ship type and how many levels should be upgraded.intcalculateRefitTime(EShipType type)Calculate the time in days it takes for refitting.intcalculateRepairCosts(int repairTime, int materialCosts)Calculate the repair costs.intcalculateRepairMaterialCosts(IShip ship, int damage)Calculate the material costs for the repair.intcalculateRepairTime(EShipType type)Calculate the repair time for the ship of type.voidcancelRepair(IShip ship)Cancel the repair of the ship.voidcancelShipBuildingOrder(java.time.LocalDateTime finish)Cancel the order of the building, finished on the given date.EShipType[]getBuildableShipTypes()Retrieve a list of all the types of ships this yard can build.java.time.LocalDateTimegetBuildCompleteDate(EShipType type)Retrieve the date when the building of a new ship will be finished.java.util.List<IShipDueDate>getShipBuildingList()Retrieve an immutable list of the ships that are ordered to be built on this shipyard.java.util.List<IShipDueDate>getShipRepairList()Retrieve the list of all ships that are to be repaired.java.util.List<IShipDueDate>getShipUpgradeList()Retrieve the list of all ships that are to be upgraded.voidinitializeExperience()voidremoveCompletedConstruction(IShip ship)Remove the build entry once it is completed.voidremoveCompletedRepair(IShip ship)Remove the repair entry once it is completed.voidremoveCompletedUpgrade(IShip ship)Remove the upgrade entry once it is completed.
-
-
-
Constructor Detail
-
ShipyardState
public ShipyardState(ICity city)
-
-
Method Detail
-
initializeExperience
@PostConstruct public void initializeExperience()
-
getShipBuildingList
public java.util.List<IShipDueDate> getShipBuildingList()
Description copied from interface:IShipyardRetrieve an immutable list of the ships that are ordered to be built on this shipyard.- Specified by:
getShipBuildingListin interfaceIShipyard- Returns:
- immutable list of ship due dates.
-
getShipUpgradeList
public java.util.List<IShipDueDate> getShipUpgradeList()
Description copied from interface:IShipyardRetrieve the list of all ships that are to be upgraded.- Specified by:
getShipUpgradeListin interfaceIShipyard- Returns:
- immutable list of all the upgrading ships
-
addShipBuildingOrder
public void addShipBuildingOrder(IShipDueDate dueDate, java.util.Optional<TimedTask> task)
Description copied from interface:IShipyardAdd an order for building a new ship to the list.- Specified by:
addShipBuildingOrderin interfaceIShipyard- Parameters:
dueDate- when the ship is finished buildingtask- that is executed on completion.
-
cancelShipBuildingOrder
public void cancelShipBuildingOrder(java.time.LocalDateTime finish)
Description copied from interface:IShipyardCancel the order of the building, finished on the given date.- Specified by:
cancelShipBuildingOrderin interfaceIShipyard- Parameters:
finish- date
-
getShipRepairList
public java.util.List<IShipDueDate> getShipRepairList()
Description copied from interface:IShipyardRetrieve the list of all ships that are to be repaired.- Specified by:
getShipRepairListin interfaceIShipyard- Returns:
- immutable list of all the repairing ships
-
addShipRepairOrder
public void addShipRepairOrder(IShipDueDate dueDate, java.util.Optional<TimedTask> task)
Description copied from interface:IShipyardAdd an order for repairing a ship to the list.- Specified by:
addShipRepairOrderin interfaceIShipyard- Parameters:
dueDate- when the ship is finished repairingtask- that is executed on completion.
-
calculateRepairMaterialCosts
public int calculateRepairMaterialCosts(IShip ship, int damage)
Description copied from interface:IShipyardCalculate the material costs for the repair.- Specified by:
calculateRepairMaterialCostsin interfaceIShipyard- Parameters:
ship- for which to calculate the material costs.damage- of the ship- Returns:
- total material costs.
-
calculateRepairCosts
public int calculateRepairCosts(int repairTime, int materialCosts)Description copied from interface:IShipyardCalculate the repair costs.- Specified by:
calculateRepairCostsin interfaceIShipyard- Parameters:
repairTime- number of days it takes for the repairmaterialCosts- costs of material that are required to be bought- Returns:
- total cost of the repair.
-
cancelRepair
public void cancelRepair(IShip ship)
Description copied from interface:IShipyardCancel the repair of the ship. No damage will be repaired- Specified by:
cancelRepairin interfaceIShipyard- Parameters:
ship- which's repair order is to be canceled
-
addShipRefitOrder
public void addShipRefitOrder(IShipDueDate dueDate, java.util.Optional<TimedTask> task)
Description copied from interface:IShipyardAdd an order for refitting a ship to the list.- Specified by:
addShipRefitOrderin interfaceIShipyard- Parameters:
dueDate- when the ship is refittedtask- that is executed on completion.
-
calculateRefitTime
public int calculateRefitTime(EShipType type)
Description copied from interface:IShipyardCalculate the time in days it takes for refitting.- Specified by:
calculateRefitTimein interfaceIShipyard- Parameters:
type- destination level- Returns:
- time in days.
-
getBuildCompleteDate
public java.time.LocalDateTime getBuildCompleteDate(EShipType type)
Description copied from interface:IShipyardRetrieve the date when the building of a new ship will be finished.- Specified by:
getBuildCompleteDatein interfaceIShipyard- Parameters:
type- of the ship to be built- Returns:
- end date of the building
-
calculateBuildTime
public int calculateBuildTime(EShipType type)
Description copied from interface:IShipyardCalculate the build time for the ship of type.- Specified by:
calculateBuildTimein interfaceIShipyard- Parameters:
type- ship type- Returns:
- total build time for a ship of type
type
-
calculateRepairTime
public int calculateRepairTime(EShipType type)
Description copied from interface:IShipyardCalculate the repair time for the ship of type.- Specified by:
calculateRepairTimein interfaceIShipyard- Parameters:
type- ship type- Returns:
- total repair time for a ship of type
type
-
calculateRefitCosts
public int calculateRefitCosts(EShipType type, int levels)
Description copied from interface:IShipyardCalculate the labor costs for the refit based on the ship type and how many levels should be upgraded.- Specified by:
calculateRefitCostsin interfaceIShipyard- Parameters:
type- ship type that should be upgradedlevels- number of upgrade levels- Returns:
- total work costs for the refit.
-
calculateConstructionCosts
public int calculateConstructionCosts(EShipType type)
Description copied from interface:IShipyardCalculate the labor costs for building a new ship of the indicated type.- Specified by:
calculateConstructionCostsin interfaceIShipyard- Parameters:
type- of the ship- Returns:
- costs.
-
getBuildableShipTypes
public EShipType[] getBuildableShipTypes()
Description copied from interface:IShipyardRetrieve a list of all the types of ships this yard can build.- Specified by:
getBuildableShipTypesin interfaceIShipyard- Returns:
- array of ship types that can be constructed.
-
removeCompletedRepair
public void removeCompletedRepair(IShip ship)
Description copied from interface:IShipyardRemove the repair entry once it is completed.- Specified by:
removeCompletedRepairin interfaceIShipyard- Parameters:
ship- that is to be repaired.
-
removeCompletedConstruction
public void removeCompletedConstruction(IShip ship)
Description copied from interface:IShipyardRemove the build entry once it is completed.- Specified by:
removeCompletedConstructionin interfaceIShipyard- Parameters:
ship- that is to be built.
-
removeCompletedUpgrade
public void removeCompletedUpgrade(IShip ship)
Description copied from interface:IShipyardRemove the upgrade entry once it is completed.- Specified by:
removeCompletedUpgradein interfaceIShipyard- Parameters:
ship- that is to be upgraded.
-
-