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

java.lang.Object
  extended by se.liu.ida.critiquer.activities.parameters.AgentParameter
All Implemented Interfaces:
Serializable, AgentChangedListener, Parameter<HashSet<Agent>>

public class AgentParameter
extends Object
implements AgentChangedListener, Parameter<HashSet<Agent>>, Serializable

One or several agents that are supposed to perform some action are collected by an AgentParameter. The AgentParameter is also capable of producing a graphical panel presenting those agents. The AgentParameter is connected to a Commander, which in turn is connected to one or several activities through CommanderParameters of the activities. Therefore this is not an ActivityParameter but only a Parameter.

This parameter is special in that it doesn't contain a value in itself but relies on a mapping between activities and agents that the commander has.

The reason for this is that ...

See Also:
Serialized Form

Constructor Summary
AgentParameter(String string, Commander commander)
           
 
Method Summary
 void agentChanged(Agent agent)
          Whenever parameters that describe the agent change, propagate that information to the activity containing this agent
 boolean deSelectAgent(Agent agent, Activity activity)
          Check with the consistency checkers in Activity if it is OK to remove this agent and remove it in such case.
 Point getAgentLocation(Agent agent)
           
 JPanel getAgentPanel()
           
 Commander getCommander()
           
 HashSet<Agent> getValue()
          We are not supposed to use this method for the agent parameter since the Commander keeps track of all agent-activity mappings.
 boolean hasValue()
           
 boolean selectAgent(Agent a)
          Check if it is ok to add this agent to the list of agents and do so if possible.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentParameter

public AgentParameter(String string,
                      Commander commander)
Method Detail

getAgentPanel

public JPanel getAgentPanel()

getAgentLocation

public Point getAgentLocation(Agent agent)

getValue

public HashSet<Agent> getValue()

We are not supposed to use this method for the agent parameter since the Commander keeps track of all agent-activity mappings.

AgentParameter objects are not connected to a single activity either so it makes no sense asking for the value of this parameter

To obtain a list of the agents taking part of an activity, use

Specified by:
getValue in interface Parameter<HashSet<Agent>>
See Also:
ActivityParameter.getValue()

hasValue

public boolean hasValue()
Specified by:
hasValue in interface Parameter<HashSet<Agent>>

selectAgent

public boolean selectAgent(Agent a)
Check if it is ok to add this agent to the list of agents and do so if possible.

Parameters:
a -
Returns:
true iff the agent can be selected.

deSelectAgent

public boolean deSelectAgent(Agent agent,
                             Activity activity)
Check with the consistency checkers in Activity if it is OK to remove this agent and remove it in such case.

Parameters:
agent -

toString

public String toString()
Overrides:
toString in class Object

agentChanged

public void agentChanged(Agent agent)
Whenever parameters that describe the agent change, propagate that information to the activity containing this agent

Specified by:
agentChanged in interface AgentChangedListener

getCommander

public Commander getCommander()
Returns:
Returns the commander.