org.mars_sim.msp.simulation.person.ai
Class Mind

java.lang.Object
  extended by org.mars_sim.msp.simulation.person.ai.Mind
All Implemented Interfaces:
java.io.Serializable

public class Mind
extends java.lang.Object
implements java.io.Serializable

The Mind class represents a person's mind. It keeps track of missions and tasks which the person is involved.

See Also:
Serialized Form

Field Summary
static java.lang.String JOB_EVENT
           
static java.lang.String MISSION_EVENT
           
 
Constructor Summary
Mind(Person person)
          Constructor
 
Method Summary
 Job getJob()
          Gets the person's job
 boolean getJobLock()
          Checks if the person's job is locked and can't be changed.
 Mission getMission()
          Returns the person's current mission.
 void getNewAction(boolean tasks, boolean missions)
          Determines a new action for the person based on available tasks, missions and active missions.
 Person getPerson()
          Returns the person owning this mind.
 PersonalityType getPersonalityType()
          Gets the person's personality type.
 SkillManager getSkillManager()
          Returns a reference to the Person's skill manager
 TaskManager getTaskManager()
          Returns the person's task manager
 boolean hasActiveMission()
          Returns true if person has an active mission.
 void setInactive()
          Set this mind as inactive.
 void setJob(Job newJob, boolean locked)
          Sets the person's job.
 void setMission(Mission newMission)
          Sets the person's current mission.
 void takeAction(double time)
          Take appropriate action for a given amount of time.
 void timePassing(double time)
          Time passing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOB_EVENT

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

MISSION_EVENT

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

Mind

public Mind(Person person)
     throws java.lang.Exception
Constructor

Parameters:
person - the person owning this mind
Throws:
java.lang.Exception - if mind could not be created.
Method Detail

timePassing

public void timePassing(double time)
                 throws java.lang.Exception
Time passing

Parameters:
time - the time passing (millisols)
Throws:
java.lang.Exception - if error.

takeAction

public void takeAction(double time)
                throws java.lang.Exception
Take appropriate action for a given amount of time.

Parameters:
time - time in millisols
Throws:
java.lang.Exception - if error during action.

getPerson

public Person getPerson()
Returns the person owning this mind.

Returns:
person

getTaskManager

public TaskManager getTaskManager()
Returns the person's task manager

Returns:
task manager

getMission

public Mission getMission()
Returns the person's current mission. Returns null if there is no current mission.

Returns:
current mission

getJob

public Job getJob()
Gets the person's job

Returns:
job or null if none.

getJobLock

public boolean getJobLock()
Checks if the person's job is locked and can't be changed.

Returns:
true if job lock.

setJob

public void setJob(Job newJob,
                   boolean locked)
Sets the person's job.

Parameters:
newJob - the new job
locked - is the job locked so another can't be chosen?

hasActiveMission

public boolean hasActiveMission()
Returns true if person has an active mission.

Returns:
true for active mission

setInactive

public void setInactive()
Set this mind as inactive. Needs move work on this; has to abort the Task can not just close it. This abort action would then allow the Mission to be also aborted.


setMission

public void setMission(Mission newMission)
Sets the person's current mission.

Parameters:
newMission - the new mission

getNewAction

public void getNewAction(boolean tasks,
                         boolean missions)
                  throws java.lang.Exception
Determines a new action for the person based on available tasks, missions and active missions.

Parameters:
tasks - can actions be tasks?
missions - can actions be new missions?
Throws:
java.lang.Exception - if new action cannot be found.

getPersonalityType

public PersonalityType getPersonalityType()
Gets the person's personality type.

Returns:
personality type.

getSkillManager

public SkillManager getSkillManager()
Returns a reference to the Person's skill manager

Returns:
the person's skill manager