se.liu.ida.critiquer.activities.parameters
Class Commander

java.lang.Object
  extended by se.liu.ida.critiquer.activities.parameters.Commander
All Implemented Interfaces:
Serializable

public class Commander
extends Object
implements Serializable

A commander has a list of activities for which this commander is responsible. Whenever choices are made in the CommanderParameter, Commander objects are notified that they should update their information on which activities they are responsible for. Agents are added to commanding activities, but commanders may choose not to use agents for specific tasks. Therefore it is possible to remove agents on a per-activity basis. To enable a more fine-grained control over which activities are associated with which agents, agents can be removed from individual sub-activities that this commander controls,

Author:
olale
See Also:
Serialized Form

Constructor Summary
Commander(String name)
           
 
Method Summary
 void addActivity(Activity a)
          Add an activity directly controlled by this commander
 void addActivityToAgentMappings(Activity a)
           
 void addMapping(Activity activity, Agent agent)
           
 void agentAdded(Agent a)
           
 void agentRemoved(Activity activity, Agent agent)
           
 ArrayList<Activity> getActivities()
          get the activities that have this commander as the value of their CommanderParameter.
 ArrayList<Activity> getActivitiesFrom(Activity rootActivity)
          Recurse through the activity tree starting at rootActivity and return a list of all activities.
 AgentParameter getAgentParameter()
           
 HashSet<Agent> getAgentsInActivity(Activity activity)
           
 ArrayList<Activity> getAllActivities()
          Recurse through the activity forest and return a list of all activities.
 String getName()
           
 HashSet<Agent> getSubordinates()
           
 void notifyActivities()
          There is no special updating to do other than related to time We must remember to update the dependent activities as well however
 void removeActivity(Activity a)
          Used when an activity that had this commander get a different one (or none at all)
 void removeActivityFromAgentMappings(Activity a)
          Used when an activity is no longer among the indirectly controlled activities under this commander.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Commander

public Commander(String name)
Method Detail

agentAdded

public void agentAdded(Agent a)

addMapping

public void addMapping(Activity activity,
                       Agent agent)

getAgentsInActivity

public HashSet<Agent> getAgentsInActivity(Activity activity)

agentRemoved

public void agentRemoved(Activity activity,
                         Agent agent)

addActivity

public void addActivity(Activity a)
Add an activity directly controlled by this commander

Parameters:
a -

addActivityToAgentMappings

public void addActivityToAgentMappings(Activity a)

removeActivity

public void removeActivity(Activity a)
Used when an activity that had this commander get a different one (or none at all)

Parameters:
a -

removeActivityFromAgentMappings

public void removeActivityFromAgentMappings(Activity a)
Used when an activity is no longer among the indirectly controlled activities under this commander. This happens when inheritance has changed.

Parameters:
a - The activity which has changed inheritance.

toString

public String toString()
Overrides:
toString in class Object

getName

public String getName()
Returns:
Returns the name.

getSubordinates

public HashSet<Agent> getSubordinates()
Returns:
Returns the agents that this commanders controls.

getAgentParameter

public AgentParameter getAgentParameter()
Returns:
Returns the agentParameter.

getActivities

public ArrayList<Activity> getActivities()
get the activities that have this commander as the value of their CommanderParameter.

Returns:
Returns the activities.

getAllActivities

public ArrayList<Activity> getAllActivities()
Recurse through the activity forest and return a list of all activities.

Returns:

getActivitiesFrom

public ArrayList<Activity> getActivitiesFrom(Activity rootActivity)
Recurse through the activity tree starting at rootActivity and return a list of all activities.

Returns:

notifyActivities

public void notifyActivities()
There is no special updating to do other than related to time We must remember to update the dependent activities as well however