Class ProductionStorage
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.city.ProductionStorage
-
public class ProductionStorage extends java.lang.ObjectThis is the local storage for the production workshops.- Author:
- Andi Hotz, (c) Sahits GmbH, 2016 Created on May 14, 2016
-
-
Constructor Summary
Constructors Constructor Description ProductionStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetAvgPrice(IWare ware)Retrieve the average price of the stored amount.doublegetStored(IWare ware)Retrieve the amount that is stored of a specific ware.doubletransfer(IWare ware, double amount, double avgPrice)Transfer wares to/from the storage.
-
-
-
Method Detail
-
getStored
public double getStored(IWare ware)
Retrieve the amount that is stored of a specific ware.- Parameters:
ware- for whicht to retrieve the stored amount- Returns:
- stored amount of
ware
-
getAvgPrice
public double getAvgPrice(IWare ware)
Retrieve the average price of the stored amount.- Parameters:
ware- for which the price is to be looked up- Returns:
- average price or 0, if the ware is not available.
-
transfer
public double transfer(IWare ware, double amount, double avgPrice)
Transfer wares to/from the storage. Negativeamountvalues mean withdrawing from the storage.- Parameters:
ware- that is to be transferedamount- to be movedavgPrice- of the ware- Returns:
- the amount that was actually transfered
-
-