public class TradingOffice extends WareHolding implements ITradingOffice
| Type | Property and Description |
|---|---|
javafx.beans.property.IntegerProperty |
capacity
Retrieve the storage capacity of the trading office and all other storages in the same city
|
javafx.beans.property.ObjectProperty<ISteward> |
steward
Property holding the steward.
|
occupiedSpaceProperty| Modifier and Type | Field and Description |
|---|---|
private IBalanceSheet |
balanceLastWeek |
private int |
baseValue
Value of the building (building costs
|
private javafx.beans.property.IntegerProperty |
capacity |
private ICity |
city
Reference to the city the trading office is located in
|
private IBalanceSheet |
currentWeek |
private Date |
date |
private java.time.LocalDateTime |
establishedDate |
private static org.apache.logging.log4j.Logger |
LOGGER |
private int |
maxCapacity
Maximal capacity of the trading office in barrels
|
private IAutomatedTrading |
officeTrading |
private IPlayer |
owner
Reference to the player
|
private DependentPropertyInitializer |
propertyInitializer |
private int |
propertyTax |
private javafx.beans.property.ObjectProperty<ISteward> |
steward |
private IStorage |
storage |
private javafx.beans.binding.BooleanBinding |
storageManagerPresent |
private IWeaponStorage |
weaponStorage
Weapons storage
|
computablePrice| Constructor and Description |
|---|
TradingOffice(IPlayer player,
ICity city,
int value,
IStorage storage,
IBalanceSheet lastWeek,
IBalanceSheet thisWeek) |
| Modifier and Type | Method and Description |
|---|---|
private void |
bindWares() |
javafx.beans.property.IntegerProperty |
capacityProperty()
Retrieve the storage capacity of the trading office and all other storages in the same city
|
protected int |
computeAVGPrice(IWare ware,
int amount)
Compute the average price for ware that is to be purchased in the specified
amount.
|
void |
destroy()
Execute when the building is destroyed.
|
Optional<ISteward> |
getSteward()
Gets the value of the property steward.
|
int |
getValue()
Retrieve the value of the building
|
boolean |
hasWeapons()
check if there are any weapons in storage
|
private void |
init() |
private void |
initWares()
Init the amount of wares available in the city
This method is protected so it can be overriden by subclasses for testing
|
int |
move(IWare ware,
int amount)
Add or remove ware from the storage.
|
int |
move(IWare ware,
int amount,
int avgPrice)
Move the ware into/from the storage with a price attached.
|
int |
move(IWeapon weapon,
int amount)
/**
Add or remove weapon from the storage.
This method is thread save.
|
void |
replaceBalanceSheet(IBalanceSheet newWeek)
Replace the last weeks balance sheet with the current week and
set the new balance sheet for this week.
|
void |
setOwner(IPlayer newOwner)
Owner of the trading office cannot be changed.
|
void |
setSteward(ISteward steward)
Sets the value of the property steward.
|
javafx.beans.property.ObjectProperty<ISteward> |
stewardProperty()
Property holding the steward.
|
javafx.beans.binding.BooleanBinding |
storageManagerPresentBinding()
Binding indicating the presence of a steward.
|
addNewWare, bindStoredAmount, containsWare, getOccupiedSpace, getWare, move, occupiedSpaceProperty, setOccupiedSpace, storedAmountBinding, unbindAllAmountsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBalanceLastWeek, getCity, getCurrentWeek, getEstablishedDate, getOccupiedSpace, getOfficeTrading, getStorage, getWare, getWeaponStorage, setOccupiedSpace, storedAmountBindinggetOwner, getPropertyTaxpublic javafx.beans.property.IntegerProperty capacityProperty
capacityProperty in interface ITradingOfficepublic javafx.beans.property.ObjectProperty<ISteward> stewardProperty
stewardProperty in interface ITradingOfficegetSteward(),
setSteward(ISteward)private static final org.apache.logging.log4j.Logger LOGGER
@Value(value="${tradingoffice.max.capacity}")
private int maxCapacity
private final IPlayer owner
private final ICity city
private final int baseValue
@Autowired private IWeaponStorage weaponStorage
@DependentValue(value="propertytax.tradingoffice") private int propertyTax
private IStorage storage
private javafx.beans.property.ObjectProperty<ISteward> steward
private IBalanceSheet balanceLastWeek
private IBalanceSheet currentWeek
private java.time.LocalDateTime establishedDate
@Autowired private IAutomatedTrading officeTrading
@Autowired private DependentPropertyInitializer propertyInitializer
@Autowired private Date date
private javafx.beans.property.IntegerProperty capacity
private javafx.beans.binding.BooleanBinding storageManagerPresent
public TradingOffice(IPlayer player, ICity city, int value, IStorage storage, IBalanceSheet lastWeek, IBalanceSheet thisWeek)
@PostConstruct private void init()
@PreDestroy public void destroy()
IBuildingprivate void initWares()
private void bindWares()
public javafx.beans.property.IntegerProperty capacityProperty()
ITradingOfficecapacityProperty in interface ITradingOfficepublic boolean hasWeapons()
ITradingOfficehasWeapons in interface ITradingOfficepublic int move(IWeapon weapon, int amount)
move in interface ITradingOfficeprotected int computeAVGPrice(IWare ware, int amount)
computeAVGPrice in class WareHoldingware - for which the average price is to be computedamount - amount that is boughtpublic int move(IWare ware, int amount, int avgPrice)
move in interface ITradingOfficeware - to be movedamount - amount to be movedavgPrice - average price to use on the amount of warepublic Optional<ISteward> getSteward()
getSteward in interface ITradingOfficepublic void setSteward(ISteward steward)
setSteward in interface ITradingOfficepublic javafx.beans.property.ObjectProperty<ISteward> stewardProperty()
ITradingOfficestewardProperty in interface ITradingOfficegetSteward(),
setSteward(ISteward)public void replaceBalanceSheet(IBalanceSheet newWeek)
ITradingOfficereplaceBalanceSheet in interface ITradingOfficepublic int move(IWare ware, int amount)
ITradingOfficemove in interface ITradingOfficepublic int getValue()
IBuildingpublic javafx.beans.binding.BooleanBinding storageManagerPresentBinding()
ITradingOfficestorageManagerPresentBinding in interface ITradingOfficeCopyright © 2011-2018 Sahits GmbH. All Rights Reserved.