org.mars_sim.msp.core.structure.goods
Class GoodsManager

java.lang.Object
  extended by org.mars_sim.msp.core.structure.goods.GoodsManager
All Implemented Interfaces:
java.io.Serializable

public class GoodsManager
extends java.lang.Object
implements java.io.Serializable

A manager for goods values at a settlement.

See Also:
Serialized Form

Field Summary
static java.lang.String GOODS_VALUE_EVENT
           
 
Constructor Summary
GoodsManager(Settlement settlement)
          Constructor
 
Method Summary
 double getGoodValuePerItem(Good good)
          Gets the value per item of a good.
 double getGoodValuePerItem(Good good, double supply)
           
 double getNumberOfGoodForSettlement(Good good)
          Gets the number of a good at the settlement.
 boolean isInitialized()
          Checks if goods manager has been initialized.
 void timePassing(double time)
          Time passing
 void updateGoodsValues()
          Updates the values for all the goods at the settlement.
 void updateGoodValue(Good good, boolean collectiveUpdate)
          Updates the value of a good at the settlement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GOODS_VALUE_EVENT

public static final java.lang.String GOODS_VALUE_EVENT
See Also:
Constant Field Values
Constructor Detail

GoodsManager

public GoodsManager(Settlement settlement)
             throws java.lang.Exception
Constructor

Parameters:
settlement - the settlement this manager is for.
Throws:
java.lang.Exception - if errors constructing instance.
Method Detail

isInitialized

public boolean isInitialized()
Checks if goods manager has been initialized.

Returns:
initialized.

getGoodValuePerItem

public double getGoodValuePerItem(Good good)
                           throws java.lang.Exception
Gets the value per item of a good.

Parameters:
good - the good to check.
Returns:
value (VP)
Throws:
java.lang.Exception - if error getting value.

getGoodValuePerItem

public double getGoodValuePerItem(Good good,
                                  double supply)
                           throws java.lang.Exception
Throws:
java.lang.Exception

timePassing

public void timePassing(double time)
                 throws java.lang.Exception
Time passing

Parameters:
time - the amount of time passing (millisols).
Throws:
java.lang.Exception - if error during time.

updateGoodsValues

public void updateGoodsValues()
                       throws java.lang.Exception
Updates the values for all the goods at the settlement.

Throws:
java.lang.Exception - if error updating goods values.

updateGoodValue

public void updateGoodValue(Good good,
                            boolean collectiveUpdate)
                     throws java.lang.Exception
Updates the value of a good at the settlement.

Parameters:
good - the good to update.
collectiveUpdate - true if this update is part of a collective good value update.
Throws:
java.lang.Exception - if error updating good value.

getNumberOfGoodForSettlement

public double getNumberOfGoodForSettlement(Good good)
                                    throws InventoryException
Gets the number of a good at the settlement.

Parameters:
good - the good to check.
Returns:
the number of the good (or amount (kg) if amount resource good).
Throws:
InventoryException - if error determining the number of the good.