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:
Serializable

public class GoodsManager
extends Object
implements Serializable

A manager for goods values at a settlement.

See Also:
Serialized Form

Field Summary
static String GOODS_VALUE_EVENT
           
 
Constructor Summary
GoodsManager(Settlement settlement)
          Constructor
 
Method Summary
 void destroy()
          Prepare object for garbage collection.
 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 String GOODS_VALUE_EVENT
See Also:
Constant Field Values
Constructor Detail

GoodsManager

public GoodsManager(Settlement settlement)
Constructor

Parameters:
settlement - the settlement this manager is for.
Throws:
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)
Gets the value per item of a good.

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

getGoodValuePerItem

public double getGoodValuePerItem(Good good,
                                  double supply)

timePassing

public void timePassing(double time)
Time passing

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

updateGoodsValues

public void updateGoodsValues()
Updates the values for all the goods at the settlement.

Throws:
Exception - if error updating goods values.

updateGoodValue

public void updateGoodValue(Good good,
                            boolean collectiveUpdate)
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:
Exception - if error updating good value.

getNumberOfGoodForSettlement

public double getNumberOfGoodForSettlement(Good good)
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.

destroy

public void destroy()
Prepare object for garbage collection.



Copyright © 2009-2013. All Rights Reserved.