org.mars_sim.msp.simulation.person.ai.task
Class CollectResources

java.lang.Object
  extended by org.mars_sim.msp.simulation.person.ai.task.Task
      extended by org.mars_sim.msp.simulation.person.ai.task.EVAOperation
          extended by org.mars_sim.msp.simulation.person.ai.task.CollectResources
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class CollectResources
extends EVAOperation
implements java.io.Serializable

The CollectResources class is a task for collecting resources at a site with an EVA from a rover.

See Also:
Serialized Form

Field Summary
protected  double collectionRate
           
protected  java.lang.Class containerType
           
protected  AmountResource resourceType
           
protected  Rover rover
           
protected  double startingCargo
           
protected  double targettedAmount
           
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.task.EVAOperation
BASE_ACCIDENT_CHANCE, containerUnit, ENTER_AIRLOCK, enteredAirlock, EXIT_AIRLOCK, exitedAirlock
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.task.Task
effortDriven, hasDuration, person, phaseTimeCompleted, phaseTimeRequired, stressModifier, subTask, TASK_DESC_EVENT, TASK_ENDED_EVENT, TASK_NAME_EVENT, TASK_PHASE_EVENT, TASK_SUBTASK_EVENT
 
Constructor Summary
CollectResources(java.lang.String taskName, Person person, Rover rover, AmountResource resourceType, double collectionRate, double targettedAmount, double startingCargo, java.lang.Class containerType)
          Constructor
 
Method Summary
protected  void addExperience(double time)
          Adds experience to the person's skills used in this task.
static boolean canCollectResources(Person person, Rover rover, java.lang.Class containerType, AmountResource resourceType)
          Checks if a person can perform an CollectResources task.
 java.util.List<java.lang.String> getAssociatedSkills()
          Gets a list of the skills associated with this task.
 int getEffectiveSkillLevel()
          Gets the effective skill level a person has at this task.
protected  double performMappedPhase(double time)
          Performs the method mapped to the task's current phase.
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.task.EVAOperation
checkForAccident, endEVA, enterAirlock, exitAirlock, getAvailableAirlock, shouldEndEVAOperation
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.task.Task
addPhase, compareTo, endTask, getCreateEvents, getCrowdingProbabilityModifier, getDescription, getDuration, getName, getPhase, getProbability, getRelationshipModifier, getSubTask, getTeacher, getTeachingExperienceModifier, getTimeCompleted, getTopPhase, hasTeacher, isDone, isEffortDriven, setCreateEvents, setDescription, setDuration, setName, setPhase, setStressModifier, setTeacher, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rover

protected Rover rover

collectionRate

protected double collectionRate

targettedAmount

protected double targettedAmount

startingCargo

protected double startingCargo

resourceType

protected AmountResource resourceType

containerType

protected java.lang.Class containerType
Constructor Detail

CollectResources

public CollectResources(java.lang.String taskName,
                        Person person,
                        Rover rover,
                        AmountResource resourceType,
                        double collectionRate,
                        double targettedAmount,
                        double startingCargo,
                        java.lang.Class containerType)
                 throws java.lang.Exception
Constructor

Parameters:
taskName - The name of the task.
person - The person performing the task.
rover - The rover used in the task.
resourceType - The resource type to collect.
collectionRate - The rate (kg/millisol) of collection.
targettedAmount - The amount (kg) desired to collect.
startingCargo - The starting amount (kg) of resource in the rover cargo.
containerType - the type of container to use to collect resource.
Throws:
java.lang.Exception - if error constructing this task.
Method Detail

performMappedPhase

protected double performMappedPhase(double time)
                             throws java.lang.Exception
Performs the method mapped to the task's current phase.

Specified by:
performMappedPhase in class Task
Parameters:
time - the amount of time the phase is to be performed.
Returns:
the remaining time after the phase has been performed.
Throws:
java.lang.Exception - if error in performing phase or if phase cannot be found.

addExperience

protected void addExperience(double time)
Adds experience to the person's skills used in this task.

Specified by:
addExperience in class Task
Parameters:
time - the amount of time (ms) the person performed this task.

canCollectResources

public static boolean canCollectResources(Person person,
                                          Rover rover,
                                          java.lang.Class containerType,
                                          AmountResource resourceType)
Checks if a person can perform an CollectResources task.

Parameters:
person - the person to perform the task
rover - the rover the person will EVA from
containerType - the container class to collect resources in.
resourceType - the resource to collect.
Returns:
true if person can perform the task.

getEffectiveSkillLevel

public int getEffectiveSkillLevel()
Gets the effective skill level a person has at this task.

Specified by:
getEffectiveSkillLevel in class Task
Returns:
effective skill level

getAssociatedSkills

public java.util.List<java.lang.String> getAssociatedSkills()
Gets a list of the skills associated with this task. May be empty list if no associated skills.

Specified by:
getAssociatedSkills in class Task
Returns:
list of skills as strings