org.mars_sim.msp.core.resource
Class AmountResource

java.lang.Object
  extended by org.mars_sim.msp.core.resource.AmountResource
All Implemented Interfaces:
Serializable, Comparable<Resource>, Resource

public final class AmountResource
extends Object
implements Resource, Serializable

The AmountResource class represents a type of resource that is a material measured in mass kg.

See Also:
Serialized Form

Constructor Summary
AmountResource(String name, Phase phase, boolean lifeSupport)
          Constructor with life support parameter.
 
Method Summary
 int compareTo(Resource o)
          Compares this object with the specified object for order.
 boolean equals(Object object)
          Checks if an object is equal to this object.
static AmountResource findAmountResource(String name)
          Finds an amount resource by name.
static Set<AmountResource> getAmountResources()
          Gets a ummutable set of all the amount resources.
 String getName()
          Gets the resource's name
 Phase getPhase()
          Gets the resources material phase.
 int hashCode()
          Gets the hash code value.
 boolean isLifeSupport()
          Checks if life support resource.
 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

AmountResource

public AmountResource(String name,
                      Phase phase,
                      boolean lifeSupport)
Constructor with life support parameter.

Parameters:
name - the resource's name
phase - the material phase of the resource.
lifeSupport - true if life support resource.
Method Detail

getName

public String getName()
Gets the resource's name

Specified by:
getName in interface Resource
Returns:
name

toString

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

Overrides:
toString in class Object

getPhase

public Phase getPhase()
Gets the resources material phase.

Returns:
phase value

isLifeSupport

public boolean isLifeSupport()
Checks if life support resource.

Returns:
true if life support resource.

findAmountResource

public static AmountResource findAmountResource(String name)
Finds an amount resource by name.

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

getAmountResources

public static Set<AmountResource> getAmountResources()
Gets a ummutable set of all the amount resources.

Returns:
set of amount resources.

equals

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

Overrides:
equals in class Object
Returns:
true if equal

hashCode

public int hashCode()
Gets the hash code value.

Overrides:
hashCode in class Object

compareTo

public int compareTo(Resource o)
Compares this object with the specified object for order.

Specified by:
compareTo in interface Comparable<Resource>
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.


Copyright © 2009-2013. All Rights Reserved.