|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mars_sim.msp.core.person.ai.mission.Mission
public abstract class Mission
The Mission class represents a large multi-person task There is at most one instance of a mission per person. A Mission may have one or more people associated with it.
| Field Summary | |
|---|---|
static String |
ADD_MEMBER_EVENT
|
static String |
ASSOCIATED_SETTLEMENT_EVENT
|
static String |
CAPACITY_EVENT
|
static String |
DESCRIPTION_EVENT
|
static String |
END_MISSION_EVENT
|
static String |
MIN_PEOPLE_EVENT
|
static String |
NAME_EVENT
|
static String |
PHASE_DESCRIPTION_EVENT
|
static String |
PHASE_EVENT
|
static String |
REMOVE_MEMBER_EVENT
|
| Constructor Summary | |
|---|---|
Mission(String name,
Person startingPerson,
int minPeople)
Constructs a Mission object |
|
| Method Summary | |
|---|---|
void |
addMissionListener(MissionListener newListener)
Adds a listener |
void |
addPerson(Person person)
Adds a person to the mission. |
void |
addPhase(String newPhase)
Adds a phase to the mission's collection of phases. |
protected void |
assignTask(Person person,
Task task)
Adds a new task for a person in the mission. |
void |
associateAllMembersWithSettlement(Settlement settlement)
Associate all mission members with a settlement. |
void |
destroy()
Prepare object for garbage collection. |
protected abstract void |
determineNewPhase()
Determines a new phase for the mission when the current phase has ended. |
void |
endMission(String reason)
Finalizes the mission. |
protected void |
fireMissionUpdate(String updateType)
Fire a mission update event. |
protected void |
fireMissionUpdate(String updateType,
Object target)
Fire a mission update event. |
abstract Settlement |
getAssociatedSettlement()
Gets the settlement associated with the mission. |
Coordinates |
getCurrentMissionLocation()
Gets the current location of the mission. |
String |
getDescription()
Gets the mission's description. |
abstract Map<Class,Integer> |
getEquipmentNeededForRemainingMission(boolean useBuffer)
Gets the number and types of equipment needed for the mission. |
int |
getMinPeople()
Gets the minimum number of people required for mission. |
int |
getMissionCapacity()
Gets the mission capacity for participating people. |
protected double |
getMissionQualification(Person person)
Gets the mission qualification value for the person. |
String |
getName()
Gets the name of the mission. |
Collection<Person> |
getPeople()
Gets a collection of the people in the mission. |
int |
getPeopleNumber()
Gets the number of people in the mission. |
String |
getPhase()
Gets the current phase of the mission. |
String |
getPhaseDescription()
Gets the description of the current phase. |
boolean |
getPhaseEnded()
Checks if the current phase has ended or not. |
abstract Map<Resource,Number> |
getResourcesNeededForRemainingMission(boolean useBuffer)
Gets the number and amounts of resources needed for the mission. |
protected boolean |
hasDangerousMedicalProblems()
Checks to see if any of the people in the mission have any dangerous medical problems that require treatment at a settlement. |
protected boolean |
hasDangerousMedicalProblemsAllCrew()
Checks to see if all of the people in the mission have any dangerous medical problems that require treatment at a settlement. |
protected boolean |
hasEmergency()
Checks if the mission has an emergency situation. |
protected boolean |
hasEmergencyAllCrew()
Checks if the mission has an emergency situation affecting all the crew. |
boolean |
hasPerson(Person person)
Determines if a mission includes the given person |
protected boolean |
isCapableOfMission(Person person)
Checks to see if a person is capable of joining a mission. |
boolean |
isDone()
Determines if mission is completed. |
void |
performMission(Person person)
Performs 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. |
void |
removeMissionListener(MissionListener oldListener)
Removes a listener |
void |
removePerson(Person person)
Removes a person from the mission |
void |
setDescription(String description)
Sets the mission's description. |
protected void |
setMinPeople(int minPeople)
Sets the minimum number of people required for a mission. |
protected void |
setMissionCapacity(int newCapacity)
Sets the mission capacity to a given value. |
protected void |
setName(String name)
Sets the name of the mission. |
protected void |
setPhase(String newPhase)
Sets the mission phase. |
protected void |
setPhaseDescription(String description)
Sets the description of the current phase. |
protected void |
setPhaseEnded(boolean phaseEnded)
Sets if the current phase has ended or not. |
void |
timePassing(double time)
Time passing for mission. |
String |
toString()
Gets the string representation of this mission. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String NAME_EVENT
public static final String DESCRIPTION_EVENT
public static final String PHASE_EVENT
public static final String PHASE_DESCRIPTION_EVENT
public static final String MIN_PEOPLE_EVENT
public static final String ASSOCIATED_SETTLEMENT_EVENT
public static final String CAPACITY_EVENT
public static final String ADD_MEMBER_EVENT
public static final String REMOVE_MEMBER_EVENT
public static final String END_MISSION_EVENT
| Constructor Detail |
|---|
public Mission(String name,
Person startingPerson,
int minPeople)
name - the name of the missionstartingPerson - the person starting the mission.minPeople - the minimum number of people required for mission.
MissionException - if error constructing mission.| Method Detail |
|---|
public final void addMissionListener(MissionListener newListener)
newListener - the listener to add.public final void removeMissionListener(MissionListener oldListener)
oldListener - the listener to remove.protected final void fireMissionUpdate(String updateType)
updateType - the update type.
protected final void fireMissionUpdate(String updateType,
Object target)
updateType - the update type.target - the event target or null if none.public String toString()
toString in class Objectpublic final void addPerson(Person person)
person - to be addedpublic final void removePerson(Person person)
person - to be removedpublic final boolean hasPerson(Person person)
person - person to be checked
public final int getPeopleNumber()
public final int getMinPeople()
protected final void setMinPeople(int minPeople)
minPeople - minimum number of peoplepublic final Collection<Person> getPeople()
public final boolean isDone()
public final String getName()
protected final void setName(String name)
name - the new mission namepublic final String getDescription()
public final void setDescription(String description)
description - the new description.public final String getPhase()
protected final void setPhase(String newPhase)
newPhase - the new mission phase.
MissionException - if newPhase is not in the mission's collection of phases.public final void addPhase(String newPhase)
newPhase - the new phase to add.public final String getPhaseDescription()
protected final void setPhaseDescription(String description)
description - the phase description.public void performMission(Person person)
person - the person performing the mission.
MissionException - if problem performing the mission.protected abstract void determineNewPhase()
MissionException - if problem setting a new phase.protected void performPhase(Person person)
person - the person performing the phase.
MissionException - if problem performing the phase.public final int getMissionCapacity()
protected final void setMissionCapacity(int newCapacity)
newCapacity - the new mission capacitypublic void endMission(String reason)
protected void assignTask(Person person,
Task task)
person - the person to assign to the tasktask - the new task to be assignedprotected final boolean hasDangerousMedicalProblems()
protected final boolean hasDangerousMedicalProblemsAllCrew()
protected boolean hasEmergency()
protected boolean hasEmergencyAllCrew()
protected void recruitPeopleForMission(Person startingPerson)
startingPerson - the person starting the mission.protected boolean isCapableOfMission(Person person)
person - the person to check.
protected double getMissionQualification(Person person)
person - the person to check.
MissionException - if error determining mission qualification.public final boolean getPhaseEnded()
protected final void setPhaseEnded(boolean phaseEnded)
phaseEnded - true if phase has endedpublic abstract Settlement getAssociatedSettlement()
public abstract Map<Resource,Number> getResourcesNeededForRemainingMission(boolean useBuffer)
useBuffer - use time buffers in estimation if true.
public abstract Map<Class,Integer> getEquipmentNeededForRemainingMission(boolean useBuffer)
useBuffer - use time buffers in estimation if true.
public void timePassing(double time)
time - the amount of time passing (in millisols)
Exception - if error during time passing.public void associateAllMembersWithSettlement(Settlement settlement)
settlement - the associated settlement.public final Coordinates getCurrentMissionLocation()
MissionException - if error determining location.public void destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||