org.mars_sim.msp.simulation.person.ai.mission
Class Mining

java.lang.Object
  extended by org.mars_sim.msp.simulation.person.ai.mission.Mission
      extended by org.mars_sim.msp.simulation.person.ai.mission.TravelMission
          extended by org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
              extended by org.mars_sim.msp.simulation.person.ai.mission.RoverMission
                  extended by org.mars_sim.msp.simulation.person.ai.mission.Mining
All Implemented Interfaces:
java.io.Serializable, UnitListener

public class Mining
extends RoverMission

Mission for mining mineral concentrations at an explored site.

See Also:
Serialized Form

Field Summary
static java.lang.String BACKHOE
           
static java.lang.String BULLDOZER_BLADE
           
static java.lang.String COLLECT_MINERALS_EVENT
           
static java.lang.String DEFAULT_DESCRIPTION
           
static java.lang.String EXCAVATE_MINERALS_EVENT
           
static java.lang.String MINING_SITE
           
static java.lang.String PNEUMATIC_DRILL
           
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.RoverMission
MIN_PEOPLE, STARTING_SETTLEMENT_EVENT
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
DISEMBARKING, EMBARKING, equipmentNeededCache, loadedFlag, OPERATOR_EVENT, TRAVELLING, VEHICLE_EVENT
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.TravelMission
AT_NAVPOINT, DISTANCE_EVENT, NAVPOINTS_EVENT, TRAVEL_STATUS_EVENT, TRAVEL_TO_NAVPOINT
 
Fields inherited from class org.mars_sim.msp.simulation.person.ai.mission.Mission
ADD_MEMBER_EVENT, ASSOCIATED_SETTLEMENT_EVENT, CAPACITY_EVENT, DESCRIPTION_EVENT, END_MISSION_EVENT, MIN_PEOPLE_EVENT, NAME_EVENT, PHASE_DESCRIPTION_EVENT, PHASE_EVENT, REMOVE_MEMBER_EVENT
 
Constructor Summary
Mining(java.util.Collection<Person> members, Settlement startingSettlement, ExploredLocation miningSite, Rover rover, LightUtilityVehicle luv, java.lang.String description)
          Constructor with explicit data.
Mining(Person startingPerson)
          Constructor
 
Method Summary
 void collectMineral(AmountResource mineral, double amount)
          Collects an amount of a mineral.
protected  void determineNewPhase()
          Determines a new phase for the mission when the current phase has ended.
 void endMiningAtSite()
          Ends mining at a site.
 void endMission(java.lang.String reason)
          Finalizes the mission
 void excavateMineral(AmountResource mineral, double amount)
          Excavates an amount of a mineral.
 Settlement getAssociatedSettlement()
          Gets the settlement associated with the mission.
 java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
          Gets the number and types of equipment needed for the mission.
 double getEstimatedRemainingMissionTime(boolean useBuffer)
          Gets the estimated time remaining for the mission.
 LightUtilityVehicle getLightUtilityVehicle()
          Gets the mission's light utility vehicle.
 double getMineralExcavationAmount(AmountResource mineral)
          Gets the amount of a mineral currently excavated.
 ExploredLocation getMiningSite()
          Gets the mission mining site.
static double getNewMissionProbability(Person person)
          Gets the weighted probability that a given person would start this mission.
 java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer, boolean parts)
          Gets the number and amounts of resources needed for the mission.
 double getTotalMineralExcavatedAmount(AmountResource mineral)
          Gets the total amount of a mineral that has been excavated so far.
protected  boolean isCapableOfMission(Person person)
          Checks to see if a person is capable of joining a mission.
protected  void performDisembarkToSettlementPhase(Person person, Settlement disembarkSettlement)
          Performs the disembark to settlement phase of the mission.
protected  void performEmbarkFromSettlementPhase(Person person)
          Performs the embark from settlement phase of the mission.
protected  void performPhase(Person person)
          The person performs the current phase of the mission.
protected  void recruitPeopleForMission(Person startingPerson)
          Recruits new people into the mission.
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.RoverMission
areVehiclesAvailable, atLeastOnePersonRemainingAtSettlement, getOperateVehicleTask, getResourcesNeededForTrip, getRover, getStartingSettlement, getVehicleWithGreatestRange, hasDangerousMedicalProblemAtAssociatedSettlement, hasEmergency, isEveryoneInRover, isNoOneInRover, isRoverInAGarage, isUsableVehicle, minAvailablePeopleAtSettlement, setStartingSettlement
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.VehicleMission
compareVehicles, determineEmergencyDestination, findClosestSettlement, getAverageVehicleSpeedForOperators, getEquipmentToLoad, getEstimatedTripTime, getFuelNeededForTrip, getLegETA, getPartsNeededForTrip, getResourcesToLoad, getTotalDistanceTravelled, getVehicle, hasEmbarkingMissions, hasEnoughResourcesForRemainingMission, hasVehicle, isVehicleLoadable, isVehicleLoaded, leaveVehicle, performTravelPhase, reserveVehicle, setEmergencyBeacon, setVehicle, timePassing, unitUpdate, updateTravelDestination
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.TravelMission
addNavpoint, clearRemainingNavpoints, getCurrentLegDistance, getCurrentLegRemainingDistance, getCurrentLegStartingTime, getCurrentNavpoint, getCurrentNavpointIndex, getNavpoint, getNavpointIndex, getNextNavpoint, getNextNavpointIndex, getNumberOfNavpoints, getPreviousNavpoint, getTotalDistance, getTotalRemainingDistance, getTravelStatus, reachedNextNode, setNavpoint, setNextNavpointIndex, startTravelToNextNode
 
Methods inherited from class org.mars_sim.msp.simulation.person.ai.mission.Mission
addMissionListener, addPerson, addPhase, assignTask, associateAllMembersWithSettlement, fireMissionUpdate, fireMissionUpdate, getCurrentMissionLocation, getDescription, getMinPeople, getMissionCapacity, getMissionQualification, getName, getPeople, getPeopleNumber, getPhase, getPhaseDescription, getPhaseEnded, hasDangerousMedicalProblems, hasDangerousMedicalProblemsAllCrew, hasEmergencyAllCrew, hasPerson, isDone, performMission, removeMissionListener, removePerson, setDescription, setMinPeople, setMissionCapacity, setName, setPhase, setPhaseDescription, setPhaseEnded, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DESCRIPTION

public static final java.lang.String DEFAULT_DESCRIPTION
See Also:
Constant Field Values

MINING_SITE

public static final java.lang.String MINING_SITE
See Also:
Constant Field Values

EXCAVATE_MINERALS_EVENT

public static final java.lang.String EXCAVATE_MINERALS_EVENT
See Also:
Constant Field Values

COLLECT_MINERALS_EVENT

public static final java.lang.String COLLECT_MINERALS_EVENT
See Also:
Constant Field Values

PNEUMATIC_DRILL

public static final java.lang.String PNEUMATIC_DRILL
See Also:
Constant Field Values

BACKHOE

public static final java.lang.String BACKHOE
See Also:
Constant Field Values

BULLDOZER_BLADE

public static final java.lang.String BULLDOZER_BLADE
See Also:
Constant Field Values
Constructor Detail

Mining

public Mining(Person startingPerson)
       throws MissionException
Constructor

Parameters:
startingPerson - the person starting the mission.
Throws:
MissionException - if error creating mission.

Mining

public Mining(java.util.Collection<Person> members,
              Settlement startingSettlement,
              ExploredLocation miningSite,
              Rover rover,
              LightUtilityVehicle luv,
              java.lang.String description)
       throws MissionException
Constructor with explicit data.

Parameters:
members - collection of mission members.
startingSettlement - the starting settlement.
miningSite - the site to mine.
rover - the rover to use.
description - the mission's description.
Throws:
MissionException - if error constructing mission.
Method Detail

getNewMissionProbability

public static double getNewMissionProbability(Person person)
Gets the weighted probability that a given person would start this mission.

Parameters:
person - the given person
Returns:
the weighted probability

determineNewPhase

protected void determineNewPhase()
                          throws MissionException
Description copied from class: VehicleMission
Determines a new phase for the mission when the current phase has ended.

Overrides:
determineNewPhase in class VehicleMission
Throws:
MissionException - if problem setting a new phase.

performPhase

protected void performPhase(Person person)
                     throws MissionException
Description copied from class: RoverMission
The person performs the current phase of the mission.

Overrides:
performPhase in class RoverMission
Parameters:
person - the person performing the phase.
Throws:
MissionException - if problem performing the phase.

performEmbarkFromSettlementPhase

protected void performEmbarkFromSettlementPhase(Person person)
                                         throws MissionException
Description copied from class: RoverMission
Performs the embark from settlement phase of the mission.

Overrides:
performEmbarkFromSettlementPhase in class RoverMission
Parameters:
person - the person currently performing the mission
Throws:
MissionException - if error performing phase.

performDisembarkToSettlementPhase

protected void performDisembarkToSettlementPhase(Person person,
                                                 Settlement disembarkSettlement)
                                          throws MissionException
Description copied from class: RoverMission
Performs the disembark to settlement phase of the mission.

Overrides:
performDisembarkToSettlementPhase in class RoverMission
Parameters:
person - the person currently performing the mission.
disembarkSettlement - the settlement to be disembarked to.
Throws:
MissionException - if error performing phase.

endMiningAtSite

public void endMiningAtSite()
Ends mining at a site.


getEquipmentNeededForRemainingMission

public java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
                                                                                       throws MissionException
Description copied from class: RoverMission
Gets the number and types of equipment needed for the mission.

Specified by:
getEquipmentNeededForRemainingMission in class RoverMission
Parameters:
useBuffer - use time buffers in estimation if true.
Returns:
map of equipment class and Integer number.
Throws:
MissionException - if error determining needed equipment.

getAssociatedSettlement

public Settlement getAssociatedSettlement()
Description copied from class: Mission
Gets the settlement associated with the mission.

Specified by:
getAssociatedSettlement in class Mission
Returns:
settlement or null if none.

isCapableOfMission

protected boolean isCapableOfMission(Person person)
Description copied from class: Mission
Checks to see if a person is capable of joining a mission.

Overrides:
isCapableOfMission in class Mission
Parameters:
person - the person to check.
Returns:
true if person could join mission.

recruitPeopleForMission

protected void recruitPeopleForMission(Person startingPerson)
Description copied from class: Mission
Recruits new people into the mission.

Overrides:
recruitPeopleForMission in class Mission
Parameters:
startingPerson - the person starting the mission.

getEstimatedRemainingMissionTime

public double getEstimatedRemainingMissionTime(boolean useBuffer)
                                        throws MissionException
Description copied from class: VehicleMission
Gets the estimated time remaining for the mission.

Overrides:
getEstimatedRemainingMissionTime in class VehicleMission
Parameters:
useBuffer - Use time buffer in estimations if true.
Returns:
time (millisols)
Throws:
MissionException

getResourcesNeededForRemainingMission

public java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer,
                                                                                      boolean parts)
                                                                               throws MissionException
Description copied from class: VehicleMission
Gets the number and amounts of resources needed for the mission.

Overrides:
getResourcesNeededForRemainingMission in class VehicleMission
Parameters:
useBuffer - use time buffers in estimation if true.
parts - include parts.
Returns:
map of amount and item resources and their Double amount or Integer number.
Throws:
MissionException - if error determining needed resources.

getMiningSite

public ExploredLocation getMiningSite()
Gets the mission mining site.

Returns:
mining site.

endMission

public void endMission(java.lang.String reason)
Description copied from class: RoverMission
Finalizes the mission

Overrides:
endMission in class RoverMission
Parameters:
reason - the reason of ending the mission.

getLightUtilityVehicle

public LightUtilityVehicle getLightUtilityVehicle()
Gets the mission's light utility vehicle.

Returns:
light utility vehicle.

getMineralExcavationAmount

public double getMineralExcavationAmount(AmountResource mineral)
Gets the amount of a mineral currently excavated.

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

getTotalMineralExcavatedAmount

public double getTotalMineralExcavatedAmount(AmountResource mineral)
Gets the total amount of a mineral that has been excavated so far.

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

excavateMineral

public void excavateMineral(AmountResource mineral,
                            double amount)
Excavates an amount of a mineral.

Parameters:
mineral - the mineral resource.
amount - the amount (kg)

collectMineral

public void collectMineral(AmountResource mineral,
                           double amount)
                    throws java.lang.Exception
Collects an amount of a mineral.

Parameters:
mineral - the mineral resource.
amount - the amount (kg)
Throws:
java.lang.Exception - if error collecting mineral.