Class AutomatedTrading
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.building.impl.AutomatedTrading
-
- All Implemented Interfaces:
IAutomatedTrading
public class AutomatedTrading extends java.lang.Object implements IAutomatedTrading
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<IWare,TradableWare>
wares
-
Constructor Summary
Constructors Constructor Description AutomatedTrading()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.property.IntegerProperty
amountProperty(IWare ware)
Get to the amount property of the tradeable ware.int
getAmount(IWare ware)
Retrieve the minimal amount of the ware that should be hold in the storage.int
getPrice(IWare ware)
Retrieve the price up to which the ware is bought or the minimal price for which it is sold.boolean
isMovableToShip(IWare ware)
Check if this ware can be moved onto ships with automated trading routesjavafx.beans.property.BooleanProperty
movableToShipProperty(IWare ware)
Get the movable to ship flag.javafx.beans.property.IntegerProperty
priceProperty(IWare ware)
Get the price property of the tradable ware.void
setMovableToShip(IWare ware, boolean isMovable)
Set the movable flagvoid
setTradingType(IWare ware, ETradeType tt)
Set the Trayding type.javafx.beans.property.ObjectProperty<ETradeType>
tradingTypeProperty(IWare ware)
Retrieve the trading type of the ware.void
updateAmount(IWare ware, int difference)
Update the amount of warevoid
updatePrice(IWare ware, int difference)
Update the price of the ware
-
-
-
Field Detail
-
wares
private java.util.HashMap<IWare,TradableWare> wares
-
-
Method Detail
-
getAmount
public int getAmount(IWare ware)
Description copied from interface:IAutomatedTrading
Retrieve the minimal amount of the ware that should be hold in the storage.- Specified by:
getAmount
in interfaceIAutomatedTrading
- Parameters:
ware
- to be hold- Returns:
- amount of that ware
-
amountProperty
public javafx.beans.property.IntegerProperty amountProperty(IWare ware)
Description copied from interface:IAutomatedTrading
Get to the amount property of the tradeable ware.- Specified by:
amountProperty
in interfaceIAutomatedTrading
- Parameters:
ware
- for which to retrieve the amount- Returns:
- max amount property that should be stored
-
getPrice
public int getPrice(IWare ware)
Description copied from interface:IAutomatedTrading
Retrieve the price up to which the ware is bought or the minimal price for which it is sold.- Specified by:
getPrice
in interfaceIAutomatedTrading
- Parameters:
ware
- to be bought or sold- Returns:
- price
-
priceProperty
public javafx.beans.property.IntegerProperty priceProperty(IWare ware)
Description copied from interface:IAutomatedTrading
Get the price property of the tradable ware.- Specified by:
priceProperty
in interfaceIAutomatedTrading
- Parameters:
ware
- for which to retrieve the price- Returns:
- max price property
-
tradingTypeProperty
public javafx.beans.property.ObjectProperty<ETradeType> tradingTypeProperty(IWare ware)
Description copied from interface:IAutomatedTrading
Retrieve the trading type of the ware. There are only three types applicable: NONE, OFFICE_CITY and CITY_OFFICE- Specified by:
tradingTypeProperty
in interfaceIAutomatedTrading
- Parameters:
ware
- that should be checked- Returns:
- trading type of the ware.
-
isMovableToShip
public boolean isMovableToShip(IWare ware)
Description copied from interface:IAutomatedTrading
Check if this ware can be moved onto ships with automated trading routes- Specified by:
isMovableToShip
in interfaceIAutomatedTrading
- Parameters:
ware
- that should be checked- Returns:
- true if the ware can be moved to a ship
-
movableToShipProperty
public javafx.beans.property.BooleanProperty movableToShipProperty(IWare ware)
Description copied from interface:IAutomatedTrading
Get the movable to ship flag.- Specified by:
movableToShipProperty
in interfaceIAutomatedTrading
- Parameters:
ware
- for which to retrieve the movable flag- Returns:
- boolean property indicating if the ware is movable to a ship
-
updateAmount
public void updateAmount(IWare ware, int difference)
Description copied from interface:IAutomatedTrading
Update the amount of ware- Specified by:
updateAmount
in interfaceIAutomatedTrading
- Parameters:
ware
- to be updateddifference
- in the amount
-
updatePrice
public void updatePrice(IWare ware, int difference)
Description copied from interface:IAutomatedTrading
Update the price of the ware- Specified by:
updatePrice
in interfaceIAutomatedTrading
- Parameters:
ware
- to be updateddifference
- in the price
-
setTradingType
public void setTradingType(IWare ware, ETradeType tt)
Description copied from interface:IAutomatedTrading
Set the Trayding type. Only allowed types are NONE, OFFICE_CITY and CITY_OFFICE- Specified by:
setTradingType
in interfaceIAutomatedTrading
- Parameters:
ware
- to be updatedtt
- trade type to set
-
setMovableToShip
public void setMovableToShip(IWare ware, boolean isMovable)
Description copied from interface:IAutomatedTrading
Set the movable flag- Specified by:
setMovableToShip
in interfaceIAutomatedTrading
- Parameters:
ware
- to be updatedisMovable
- flag if the ware is movable to a ship
-
-