|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.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 java.lang.String |
ADD_MEMBER_EVENT
|
static java.lang.String |
ASSOCIATED_SETTLEMENT_EVENT
|
static java.lang.String |
CAPACITY_EVENT
|
static java.lang.String |
DESCRIPTION_EVENT
|
static java.lang.String |
END_MISSION_EVENT
|
static java.lang.String |
MIN_PEOPLE_EVENT
|
static java.lang.String |
NAME_EVENT
|
static java.lang.String |
PHASE_DESCRIPTION_EVENT
|
static java.lang.String |
PHASE_EVENT
|
static java.lang.String |
REMOVE_MEMBER_EVENT
|
Constructor Summary | |
---|---|
Mission(java.lang.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(java.lang.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. |
protected abstract void |
determineNewPhase()
Determines a new phase for the mission when the current phase has ended. |
void |
endMission(java.lang.String reason)
Finalizes the mission. |
protected void |
fireMissionUpdate(java.lang.String updateType)
Fire a mission update event. |
protected void |
fireMissionUpdate(java.lang.String updateType,
java.lang.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. |
java.lang.String |
getDescription()
Gets the mission's description. |
abstract java.util.Map<java.lang.Class,java.lang.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. |
java.lang.String |
getName()
Gets the name of the mission. |
static double |
getNewMissionProbability(Person person)
Gets the weighted probability that a given person would start this mission. |
java.util.Collection<Person> |
getPeople()
Gets a collection of the people in the mission. |
int |
getPeopleNumber()
Gets the number of people in the mission. |
java.lang.String |
getPhase()
Gets the current phase of the mission. |
java.lang.String |
getPhaseDescription()
Gets the description of the current phase. |
protected boolean |
getPhaseEnded()
Checks if the current phase has ended or not. |
abstract java.util.Map<Resource,java.lang.Number> |
getResourcesNeededForRemainingMission(boolean useBuffer,
boolean parts)
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 abstract 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(java.lang.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(java.lang.String name)
Sets the name of the mission. |
protected void |
setPhase(java.lang.String newPhase)
Sets the mission phase. |
protected void |
setPhaseDescription(java.lang.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. |
java.lang.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 java.lang.String NAME_EVENT
public static final java.lang.String DESCRIPTION_EVENT
public static final java.lang.String PHASE_EVENT
public static final java.lang.String PHASE_DESCRIPTION_EVENT
public static final java.lang.String MIN_PEOPLE_EVENT
public static final java.lang.String ASSOCIATED_SETTLEMENT_EVENT
public static final java.lang.String CAPACITY_EVENT
public static final java.lang.String ADD_MEMBER_EVENT
public static final java.lang.String REMOVE_MEMBER_EVENT
public static final java.lang.String END_MISSION_EVENT
Constructor Detail |
---|
public Mission(java.lang.String name, Person startingPerson, int minPeople) throws MissionException
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(java.lang.String updateType)
updateType
- the update type.protected final void fireMissionUpdate(java.lang.String updateType, java.lang.Object target)
updateType
- the update type.target
- the event target or null if none.public java.lang.String toString()
toString
in class java.lang.Object
public 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 java.util.Collection<Person> getPeople()
public final boolean isDone()
public final java.lang.String getName()
protected final void setName(java.lang.String name)
name
- the new mission namepublic final java.lang.String getDescription()
public final void setDescription(java.lang.String description)
description
- the new description.public final java.lang.String getPhase()
protected final void setPhase(java.lang.String newPhase) throws MissionException
newPhase
- the new mission phase.
MissionException
- if newPhase is not in the mission's collection of phases.public final void addPhase(java.lang.String newPhase)
newPhase
- the new phase to add.public final java.lang.String getPhaseDescription()
protected final void setPhaseDescription(java.lang.String description)
description
- the phase description.public void performMission(Person person) throws MissionException
person
- the person performing the mission.
MissionException
- if problem performing the mission.protected abstract void determineNewPhase() throws MissionException
MissionException
- if problem setting a new phase.protected abstract void performPhase(Person person) throws MissionException
person
- the person performing the phase.
MissionException
- if problem performing the phase.public static double getNewMissionProbability(Person person)
person
- the given person
public final int getMissionCapacity()
protected final void setMissionCapacity(int newCapacity)
newCapacity
- the new mission capacitypublic void endMission(java.lang.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) throws MissionException
person
- the person to check.
MissionException
- if error determining mission qualification.protected final boolean getPhaseEnded()
protected final void setPhaseEnded(boolean phaseEnded)
phaseEnded
- true if phase has endedpublic abstract Settlement getAssociatedSettlement()
public abstract java.util.Map<Resource,java.lang.Number> getResourcesNeededForRemainingMission(boolean useBuffer, boolean parts) throws MissionException
useBuffer
- use time buffers in estimation if true.parts
- include parts.
MissionException
- if error determining needed resources.public abstract java.util.Map<java.lang.Class,java.lang.Integer> getEquipmentNeededForRemainingMission(boolean useBuffer) throws MissionException
useBuffer
- use time buffers in estimation if true.
MissionException
- if error determining needed equipment.public void timePassing(double time) throws java.lang.Exception
time
- the amount of time passing (in millisols)
java.lang.Exception
- if error during time passing.public void associateAllMembersWithSettlement(Settlement settlement)
settlement
- the associated settlement.public final Coordinates getCurrentMissionLocation() throws MissionException
MissionException
- if error determining location.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |