ch.sahits.game.openpatrician.model.product
Interface IWare

All Superinterfaces:
IAmountable
All Known Implementing Classes:
EWare

public interface IWare
extends IAmountable

Interface defining a ware. The ware provides general information on the item it represents. It also provides methods to compute the sell and buy price of the ware based on the available amount. The price computation uses the following constants:
MAX: the maximum price for the item if it is not available in the market. Here the function has a glitch for the buy price: If no item is available it cannot be sold and the price is therefore 0 (infinity would be logical correct but is not very understandable in the game context).
MIN: the minimal price of the item if more than SATURATION items are available in the market. As more items are available in the market the price approaches this value asymptoticly.
SATURATION: amount of items when the the need is fullfilled. If there are more items available in the market than needed all have the MIN price. This is a further simplification because the price normally drops further if there are much more items available. The curve would bee leveling out at SATURATION and then dropping further.
ABS_MIN: the absolut minimum is the minimal sell price at SATURATION.

   (MAX-MIN)*(MIN+1)
 --------------------- + ABS_MIN
 ex*15/(SATURATION*2)+MIN
 

Author:
Andi Hotz, (c) Sahits GmbH, 2011 Created on Jan 15, 2011

Method Summary
 int computeBuyPrice(int availableAmount, int amountToBuy)
          Compute the price for the wares to be bought.
 int computeSellPrice(int availableAmount, int amountToSell)
          Compute the price for the wares to be soled.
 String getLocalDisplayName()
           
 int getMarketSaturation()
          Retrieve the amount of units which is considered infinite.
 int getMaxValueBuy()
          Retrieve the value that is maximal payed for one unit of this ware if no ware is available.
 int getMaxValueSell()
           
 int getMinValueBuy()
          Retrieve the value of the minimal payed sum for on unit if an infinitly amount of the ware exists.
 int getMinValueSell()
           
 short getSizeAsBarrels()
          Retrieve the size of the ware converted into the smallest size unit (barrels)
 String name()
          As this interface is implemented by an enumeration add this method
 

Method Detail

getLocalDisplayName

String getLocalDisplayName()

getMaxValueBuy

int getMaxValueBuy()
Retrieve the value that is maximal payed for one unit of this ware if no ware is available.

Returns:

getMinValueBuy

int getMinValueBuy()
Retrieve the value of the minimal payed sum for on unit if an infinitly amount of the ware exists.

Returns:

computeSellPrice

int computeSellPrice(int availableAmount,
                     int amountToSell)
Compute the price for the wares to be soled. The price is computed based on the amount that is available and the amount that is sold. The price is never higher than getMaxValueBuy() and approaches getMinValueBuy() assymtotically.

Parameters:
availableAmount - Amount of the ware that is available
amountToSell - Amount of ware that is to be sold
Returns:
price of the ware.

computeBuyPrice

int computeBuyPrice(int availableAmount,
                    int amountToBuy)
Compute the price for the wares to be bought. The price is computed on the amount that is available and the amount to be bought. The price is never highter than getMaxValueBuy() plus a ware specific constant.

Parameters:
availableAmount - Amount of the ware that is available
amountToBuy - Amount of ware that is to be bought
Returns:
price of the ware

getSizeAsBarrels

short getSizeAsBarrels()
Retrieve the size of the ware converted into the smallest size unit (barrels)

Returns:

getMarketSaturation

int getMarketSaturation()
Retrieve the amount of units which is considered infinite. This influences the price because if there are so much units of the ware available the selling price will be the minimum.

Returns:

getMinValueSell

int getMinValueSell()

getMaxValueSell

int getMaxValueSell()

name

String name()
As this interface is implemented by an enumeration add this method

Returns:


Copyright © 2011-2012 Sahits GmbH. All Rights Reserved.