org.mars_sim.msp.simulation.resource
Class AmountResourceStorage

java.lang.Object
  extended by org.mars_sim.msp.simulation.resource.AmountResourceStorage
All Implemented Interfaces:
java.io.Serializable

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

Storage for amount resources.

See Also:
Serialized Form

Constructor Summary
AmountResourceStorage()
           
 
Method Summary
 void addAmountResourcePhaseCapacity(Phase phase, double capacity)
          Adds capacity for a resource phase.
 void addAmountResourceTypeCapacity(AmountResource resource, double capacity)
          Adds capacity for a resource type.
 java.util.Set<AmountResource> getAllAmountResourcesStored()
          Gets all of the amount resources stored.
 double getAmountResourceCapacity(AmountResource resource)
          Gets the storage capacity for a resource.
 java.util.Map<Phase,java.lang.Double> getAmountResourcePhaseCapacities()
          Gets the phase capacities in storage.
 double getAmountResourceRemainingCapacity(AmountResource resource)
          Gets the remaining capacity available for a resource.
 double getAmountResourceStored(AmountResource resource)
          Gets the amount of a resource stored.
 java.util.Map<AmountResource,java.lang.Double> getAmountResourceTypeCapacities()
          Gets the amount resources and the type capacity for them.
 double getTotalAmountResourcesStored()
          Gets the total amount of resources stored.
 boolean hasAmountResourceCapacity(AmountResource resource)
          Checks if storage has capacity for a resource.
 void retrieveAmountResource(AmountResource resource, double amount)
          Retrieves an amount of a resource from storage.
 void storeAmountResource(AmountResource resource, double amount)
          Store an amount of a resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AmountResourceStorage

public AmountResourceStorage()
Method Detail

addAmountResourceTypeCapacity

public void addAmountResourceTypeCapacity(AmountResource resource,
                                          double capacity)
                                   throws ResourceException
Adds capacity for a resource type.

Parameters:
resource - the resource.
capacity - the capacity amount (kg).
Throws:
ResourceException - if error setting capacity.

getAmountResourceTypeCapacities

public java.util.Map<AmountResource,java.lang.Double> getAmountResourceTypeCapacities()
Gets the amount resources and the type capacity for them.

Returns:
map of all amount resources that have type capacity.

addAmountResourcePhaseCapacity

public void addAmountResourcePhaseCapacity(Phase phase,
                                           double capacity)
                                    throws ResourceException
Adds capacity for a resource phase.

Parameters:
phase - the phase
capacity - the capacity amount (kg).
Throws:
ResourceException - if error adding capacity.

getAmountResourcePhaseCapacities

public java.util.Map<Phase,java.lang.Double> getAmountResourcePhaseCapacities()
Gets the phase capacities in storage.

Returns:
map of phases with capacities.

hasAmountResourceCapacity

public boolean hasAmountResourceCapacity(AmountResource resource)
Checks if storage has capacity for a resource.

Parameters:
resource - the resource.
Returns:
true if storage capacity.

getAmountResourceCapacity

public double getAmountResourceCapacity(AmountResource resource)
Gets the storage capacity for a resource.

Parameters:
resource - the resource.
Returns:
capacity amount (kg).

getAmountResourceStored

public double getAmountResourceStored(AmountResource resource)
Gets the amount of a resource stored.

Parameters:
resource - the resource.
Returns:
stored amount (kg).

getAllAmountResourcesStored

public java.util.Set<AmountResource> getAllAmountResourcesStored()
Gets all of the amount resources stored.

Returns:
set of amount resources.

getTotalAmountResourcesStored

public double getTotalAmountResourcesStored()
Gets the total amount of resources stored.

Returns:
stored amount (kg).

getAmountResourceRemainingCapacity

public double getAmountResourceRemainingCapacity(AmountResource resource)
Gets the remaining capacity available for a resource.

Parameters:
resource - the resource.
Returns:
remaining capacity amount (kg).

storeAmountResource

public void storeAmountResource(AmountResource resource,
                                double amount)
                         throws ResourceException
Store an amount of a resource.

Parameters:
resource - the resource.
amount - the amount (kg).
Throws:
ResourceException - if error storing resource.

retrieveAmountResource

public void retrieveAmountResource(AmountResource resource,
                                   double amount)
                            throws ResourceException
Retrieves an amount of a resource from storage.

Parameters:
resource - the resource.
amount - the amount (kg).
Throws:
ResourceException - if error retrieving resource.