|
||||||||||
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.task.Task
public abstract class Task
The Task class is an abstract parent class for tasks that allow people to do various things. A person's TaskManager keeps track of one current task for the person, but a task may use other tasks internally to accomplish things.
Field Summary | |
---|---|
protected boolean |
effortDriven
|
protected boolean |
hasDuration
|
protected Person |
person
|
protected double |
phaseTimeCompleted
|
protected double |
phaseTimeRequired
|
protected double |
stressModifier
|
protected Task |
subTask
|
static java.lang.String |
TASK_DESC_EVENT
|
static java.lang.String |
TASK_ENDED_EVENT
|
static java.lang.String |
TASK_NAME_EVENT
|
static java.lang.String |
TASK_PHASE_EVENT
|
static java.lang.String |
TASK_SUBTASK_EVENT
|
Constructor Summary | |
---|---|
Task(java.lang.String name,
Person person,
boolean effort,
boolean createEvents,
double stressModifier,
boolean hasDuration,
double duration)
Constructs a Task object. |
Method Summary | |
---|---|
protected abstract void |
addExperience(double time)
Adds experience to the person's skills used in this task. |
protected void |
addPhase(java.lang.String newPhase)
Adds a phase to the task's collection of phases. |
int |
compareTo(java.lang.Object other)
Compare this object to another for an ordering. |
void |
endTask()
Ends the task and performs any final actions. |
abstract java.util.List<java.lang.String> |
getAssociatedSkills()
Gets a list of the skills associated with this task. |
boolean |
getCreateEvents()
Returns a boolean whether this task should generate events |
protected static double |
getCrowdingProbabilityModifier(Person person,
Building newBuilding)
Gets the probability modifier for a task if person needs to go to a new building. |
java.lang.String |
getDescription()
Returns a string that is a description of what the task is currently doing. |
protected double |
getDuration()
Gets the duration of the task or 0 if none. |
abstract int |
getEffectiveSkillLevel()
Gets the effective skill level a person has at this task. |
java.lang.String |
getName()
Returns the name of the task. |
java.lang.String |
getPhase()
Gets a string of the current phase of the task. |
static double |
getProbability(Person person)
Returns the weighted probability that a person might perform this task. |
protected static double |
getRelationshipModifier(Person person,
Building building)
Gets the probability modifier for a person performing a task based on his/her relationships with the people in the room the task is to be performed in. |
Task |
getSubTask()
Gets the task's subtask. |
Person |
getTeacher()
Gets the person teaching this task. |
protected double |
getTeachingExperienceModifier()
Gets the experience modifier when being taught by a teacher. |
protected double |
getTimeCompleted()
Gets the amount of time the task has completed. |
java.lang.String |
getTopPhase()
Gets a string of the current phase of this task, ignoring subtasks. |
boolean |
hasTeacher()
Checks if someone is teaching this task to the person performing it. |
boolean |
isDone()
Determines if task is still active. |
boolean |
isEffortDriven()
Return the value of the effort driven flag. |
protected abstract double |
performMappedPhase(double time)
Performs the method mapped to the task's current phase. |
protected void |
setCreateEvents(boolean create)
SHould the start of this task create an historical event. |
protected void |
setDescription(java.lang.String description)
Sets the task's description. |
protected void |
setDuration(double newDuration)
Sets the duration of the task |
protected void |
setName(java.lang.String name)
Sets the task's name. |
protected void |
setPhase(java.lang.String newPhase)
Sets the task's current phase. |
protected void |
setStressModifier(double newStressModifier)
Set the task's stress modifier. |
void |
setTeacher(Person newTeacher)
Sets the person teaching this task. |
java.lang.String |
toString()
Get a string representation of this Task. |
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 TASK_NAME_EVENT
public static final java.lang.String TASK_DESC_EVENT
public static final java.lang.String TASK_PHASE_EVENT
public static final java.lang.String TASK_ENDED_EVENT
public static final java.lang.String TASK_SUBTASK_EVENT
protected Person person
protected boolean hasDuration
protected Task subTask
protected double phaseTimeRequired
protected double phaseTimeCompleted
protected boolean effortDriven
protected double stressModifier
Constructor Detail |
---|
public Task(java.lang.String name, Person person, boolean effort, boolean createEvents, double stressModifier, boolean hasDuration, double duration) throws java.lang.Exception
name
- the name of the taskperson
- the person performing the taskeffort
- Does this task require physical effortcreateEvents
- Does this task create events?stressModifier
- stress modified by person performing task per millisol.hasDuration
- Does the task have a time duration?duration
- the time duration (in millisols) of the task (or 0 if none)
java.lang.Exception
- if task could not be constructed.Method Detail |
---|
public void endTask()
public boolean isEffortDriven()
public java.lang.String getName()
protected void setName(java.lang.String name)
name
- the task name.public java.lang.String getDescription()
protected void setDescription(java.lang.String description)
description
- the task description.public boolean getCreateEvents()
public java.lang.String getPhase()
public java.lang.String getTopPhase()
protected void setPhase(java.lang.String newPhase) throws java.lang.Exception
newPhase
- the phase to set the a task at.
java.lang.Exception
- if newPhase is not in the task's collection of phases.protected void addPhase(java.lang.String newPhase)
newPhase
- the new phase to add.public boolean isDone()
public Task getSubTask()
public static double getProbability(Person person)
person
- the person to perform the task
protected abstract double performMappedPhase(double time) throws java.lang.Exception
time
- the amount of time (millisol) the phase is to be performed.
java.lang.Exception
- if error in performing phase or if phase cannot be found.protected void setCreateEvents(boolean create)
create
- New flag value.public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- Object to compare against.
java.lang.ClassCastException
- if the object in not of a Task.protected void setStressModifier(double newStressModifier)
newStressModifier
- stress modification per millisol.protected static double getCrowdingProbabilityModifier(Person person, Building newBuilding) throws BuildingException
person
- the person to perform the task.newBuilding
- the building the person is to go to.
BuildingException
- if current or new building doesn't have life support function.public abstract int getEffectiveSkillLevel()
public abstract java.util.List<java.lang.String> getAssociatedSkills()
public boolean hasTeacher()
public Person getTeacher()
public void setTeacher(Person newTeacher)
newTeacher
- the new teacher.protected double getTeachingExperienceModifier()
protected static double getRelationshipModifier(Person person, Building building) throws BuildingException
person
- the person to check for.building
- the building the person will need to be in for the task.
BuildingException
protected abstract void addExperience(double time)
time
- the amount of time (ms) the person performed this task.protected double getDuration()
protected void setDuration(double newDuration)
newDuration
- the new duration (millisol)protected double getTimeCompleted()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |