|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectse.liu.ida.critiquer.resources.Agent
public abstract class Agent
Agents are a part of and perform activities. They are added and removed via the Resource View.
In order for an agent to be considered suitable for an activity is should put
the appropriate entries into the fitnessMap
class field.
Also, in order to calculate how long it takes for an agent to perform an
activity, the missionContributionCalculators
map is used to
look up procedures that calculate the time it takes an agent to perform some
unit of work on an activity. Moreover, performing an operation may have
side-effects which are modelled by having a HashMap
as an
argument to a AgentContributionCalculator
that may be modified
by the agent while performing some action.
It is not intended that a single "use" of an agent solves a task, since it may be impossible for an agent to complete a task on its own or it may be more appropriate if the agent performs only a small part of it. As it is right now, the agent reports some number on how long it takes to perform (possibly only a part of) the mission and the activity is responsible for accumulating this information into some overall time for the mission as a whole.
Field Summary | |
---|---|
protected AgentSimulationState |
agentSimulationState
|
static Agent |
dummyAgent
Placeholder agent to be used when the side-effects of using an agent is desirable and the most convenient way is to have a placeholder agent |
protected static HashMap<Class,HashMap<Class,Suitability>> |
fitnessMap
|
HashMap<Class,AgentContributionCalculator> |
missionContributionCalculators
|
String |
name
|
Constructor Summary | |
---|---|
Agent(Agent parent,
String name)
|
|
Agent(String name)
|
Method Summary | ||
---|---|---|
void |
addAgentChangedListener(AgentParameter parameter)
|
|
void |
addChild(Agent child)
|
|
|
addParameter(ParameterInAgent<T> param)
|
|
boolean |
equals(Object o)
Compare agents with respect to their names |
|
ArrayList<Activity> |
getActivitiesForAgent()
|
|
AgentSimulationState |
getAgentSimulationState()
|
|
ArrayList<Agent> |
getChildren()
|
|
AgentLabel |
getLabel(AgentParameter param)
|
|
JPanel |
getPanel()
|
|
|
getParamByClassAndName(Class<C> c,
AgentParameterName name)
|
|
Agent |
getParent()
|
|
ImageIcon |
getPicture()
|
|
static Suitability |
getSuitability(Agent agent,
Activity activity)
Should agents or constraints be responsible for knowing which agent is suitable for which task? |
|
Color |
getTimeLineColor()
|
|
int |
hashCode()
Use the name for hash value |
|
void |
initAgentSimulationState(SimulationEngine engine)
|
|
protected void |
initPanel()
Take all user-visible parameters of this agent and add them to the panel |
|
void |
notifyAgentChangedListeners()
Notify AgentParameters containing this agent that it has changed some property |
|
|
perform(Class<T> activityClass,
T activity,
HashMap<Activity.Properties,Integer> activityAttributes)
Perform activity of class activityClass by
dispatching to the appropriate procedure. |
|
void |
removeAgentChangedListener(AgentParameter parameter)
|
|
void |
setPicture(ImageIcon picture)
|
|
void |
setPictureFromName(String fileName)
Create an image baased on a filename pointing to the resource directory. |
|
void |
setTimeLineColor(Color timeLineColor)
|
|
String |
toString()
Returns the name of this agent |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static Agent dummyAgent
protected static HashMap<Class,HashMap<Class,Suitability>> fitnessMap
public HashMap<Class,AgentContributionCalculator> missionContributionCalculators
public String name
protected transient AgentSimulationState agentSimulationState
Constructor Detail |
---|
public Agent(String name)
name
- public Agent(Agent parent, String name)
parent
- is supposed to be an organizational unit that contains this
agent, null if not applicablename
- Method Detail |
---|
public <T> void addParameter(ParameterInAgent<T> param)
public <C> ParameterInAgent<C> getParamByClassAndName(Class<C> c, AgentParameterName name)
public String toString()
toString
in class Object
Object.toString()
protected void initPanel()
public ArrayList<Activity> getActivitiesForAgent()
public void initAgentSimulationState(SimulationEngine engine)
public AgentSimulationState getAgentSimulationState()
public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public void addChild(Agent child)
public AgentLabel getLabel(AgentParameter param)
public static Suitability getSuitability(Agent agent, Activity activity)
public <T extends Activity> long perform(Class<T> activityClass, T activity, HashMap<Activity.Properties,Integer> activityAttributes) throws UnsupportedOperationException
activity
of class activityClass
by
dispatching to the appropriate procedure. When we "perform" a mission, we
may modify some attributes that were set in the activityAttributes map.
For now, there is no good "standard" way of finding out which attributes
are present and how they should be modified, but the idea is that the
agents and activities in a scenario are developed in tandem with good
knowledge of each other. In the standard scenario, the
StandardAgentParameterFactory
knows of the attributes in
activities in the standard scenario package.
These attributes reflect properties of the activity, not the agent.
UnsupportedOperationException
public Color getTimeLineColor()
public void setTimeLineColor(Color timeLineColor)
timeLineColor
- The timeLineColor to set.public ArrayList<Agent> getChildren()
public Agent getParent()
public JPanel getPanel()
public void addAgentChangedListener(AgentParameter parameter)
public void removeAgentChangedListener(AgentParameter parameter)
public void notifyAgentChangedListeners()
public ImageIcon getPicture()
public void setPicture(ImageIcon picture)
picture
- The picture to set.public void setPictureFromName(String fileName)
fileName
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |