org.mars_sim.msp.simulation.resource
Class ItemResource

java.lang.Object
  extended by org.mars_sim.msp.simulation.resource.ItemResource
All Implemented Interfaces:
java.io.Serializable, Resource
Direct Known Subclasses:
Part

public class ItemResource
extends java.lang.Object
implements Resource, java.io.Serializable

The ItemResource class represents a type of resource that is measured in units, such as simple tools and parts.

See Also:
Serialized Form

Constructor Summary
protected ItemResource(java.lang.String name, double massPerItem)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object object)
          Checks if an object is equal to this object.
static ItemResource findItemResource(java.lang.String name)
          Finds an item resource by name.
static java.util.Set<ItemResource> getItemResources()
          Gets a ummutable set of all the item resources.
 double getMassPerItem()
          Gets the mass for an item of the resource.
 java.lang.String getName()
          Gets the resource's name.
static ItemResource getTestResourceHammer()
          Gets a mock item resource of a hammer.
static ItemResource getTestResourcePipeWrench()
          Gets a mock item resource of a pipe wrench.
static ItemResource getTestResourceSocketWrench()
          Gets a mock item resource of a socket wrench.
 int hashCode()
          Gets the hash code value.
 java.lang.String toString()
          Returns the resource as a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ItemResource

protected ItemResource(java.lang.String name,
                       double massPerItem)
Constructor

Parameters:
name - the name of the resource.
massPerItem - the mass (kg) of the resource per item.
Method Detail

getName

public java.lang.String getName()
Gets the resource's name.

Specified by:
getName in interface Resource
Returns:
name of resource.

toString

public java.lang.String toString()
Returns the resource as a string.

Overrides:
toString in class java.lang.Object

getMassPerItem

public double getMassPerItem()
Gets the mass for an item of the resource.

Returns:
mass (kg)

equals

public boolean equals(java.lang.Object object)
Checks if an object is equal to this object.

Overrides:
equals in class java.lang.Object
Returns:
true if equal

hashCode

public int hashCode()
Gets the hash code value.

Overrides:
hashCode in class java.lang.Object

findItemResource

public static final ItemResource findItemResource(java.lang.String name)
                                           throws ResourceException
Finds an item resource by name.

Parameters:
name - the name of the resource.
Returns:
resource
Throws:
ResourceException - if resource could not be found.

getItemResources

public static final java.util.Set<ItemResource> getItemResources()
Gets a ummutable set of all the item resources.

Returns:
set of item resources.

getTestResourceHammer

public static final ItemResource getTestResourceHammer()
Gets a mock item resource of a hammer.

Returns:
item resource.

getTestResourceSocketWrench

public static final ItemResource getTestResourceSocketWrench()
Gets a mock item resource of a socket wrench.

Returns:
item resource.

getTestResourcePipeWrench

public static final ItemResource getTestResourcePipeWrench()
Gets a mock item resource of a pipe wrench.

Returns:
item resource.