fr.lifl.magique.util
Class Team

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byfr.lifl.magique.util.Team
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Team
extends java.util.Hashtable

maps a member of the team (identified by his name) with a TeamInfo object that contains two vectors : the members of the subteams and the vector of what they are able to do.

See Also:
Hashtable, TeamInfo, Serialized Form

Constructor Summary
Team()
           
 
Method Summary
 void addInfo(java.lang.String agent, java.lang.String newMember, TeamInfo memberInfo)
          updates info associated to the agent when a new member is added in his subteam
 void addMethods(java.lang.String agent, java.util.Vector newMethods)
          updates info associated to the agent when a member has new methods (skills)
 java.util.Enumeration getMembers()
          returns the (first level) members of the team
 java.util.Vector getMethods()
          returns the vector of all the names of methods appearing in this team and the relative TeamInfo.
 java.util.Vector getNames()
          returns the vector of all the names of agent appearing in this team and the relative TeamInfo.
 TeamInfo getTeamInfo(java.lang.String agent)
          returns the TeamInfo associated to an agent
 int getTeamSize()
          Returns the size of this tem ie the number of first level members
 boolean knownMethod(java.lang.String method)
           
 boolean knownName(java.lang.String name)
          returns true if agent appears somewhere in this team (maybe in a subteam)
 void newMember(java.lang.String agent, TeamInfo info)
          adds an agent and its TeamInfo info to the team
 void remove(java.lang.String agent)
          remove an agent from my team
 java.util.Vector whoKnowsMethod(java.lang.String method)
          returns the vector of the names of the agents (of the first level of hierarchy below) who are able to perform the given method (or maybe someone below it).
 java.lang.String whoKnowsName(java.lang.String name)
          returns the name of the agent (first level of hierarchy below) who knows the given name (which can be in a "sublevel").
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Team

public Team()
Method Detail

getTeamInfo

public TeamInfo getTeamInfo(java.lang.String agent)
returns the TeamInfo associated to an agent

Parameters:
agent - name of the agent
Returns:
the associated TeamInfo
Throws:
java.lang.NullPointerException - si agent est inconnu
java.lang.NullPointerException - if agent is unknown
See Also:
TeamInfo

getMembers

public java.util.Enumeration getMembers()
returns the (first level) members of the team

Returns:
the (first level) members of the team

getTeamSize

public int getTeamSize()
Returns the size of this tem ie the number of first level members

Returns:
the size of this tem ie the number of first level members

newMember

public void newMember(java.lang.String agent,
                      TeamInfo info)
adds an agent and its TeamInfo info to the team

Parameters:
agent - the name of the agent to add
info - the associated TeamInfo object

remove

public void remove(java.lang.String agent)
remove an agent from my team

Parameters:
agent - the agent to remove from my team

addInfo

public void addInfo(java.lang.String agent,
                    java.lang.String newMember,
                    TeamInfo memberInfo)
updates info associated to the agent when a new member is added in his subteam

Parameters:
agent - the name of the agent
newMember - the new member of the subteam
memberInfo - the team info associated to the new member

addMethods

public void addMethods(java.lang.String agent,
                       java.util.Vector newMethods)
updates info associated to the agent when a member has new methods (skills)

Parameters:
agent - the name of the agent who has lerned
newMethods - vector of the new methods to be added to info on agent

getNames

public java.util.Vector getNames()
returns the vector of all the names of agent appearing in this team and the relative TeamInfo. Without repetition if any.

Returns:
the vector of all the names of agent appearing in this team and the relative TeamInfo

getMethods

public java.util.Vector getMethods()
returns the vector of all the names of methods appearing in this team and the relative TeamInfo. Without repetition if any.

Returns:
the vector of all the names of methods appearing in this team and the relative TeamInfo

knownName

public boolean knownName(java.lang.String name)
returns true if agent appears somewhere in this team (maybe in a subteam)

Parameters:
name - the name of the searched agent
Returns:
true if agent appears somewhere in this team (maybe in a subteam)

knownMethod

public boolean knownMethod(java.lang.String method)
Returns:
true if method appears somewhere in this team (maybe in a subteam)

whoKnowsMethod

public java.util.Vector whoKnowsMethod(java.lang.String method)
returns the vector of the names of the agents (of the first level of hierarchy below) who are able to perform the given method (or maybe someone below it). It is assumed that at list one agent in the team (or subteams) is candidate.

Parameters:
method - the name of the method to look for
Returns:
the vector of the names of the agents of the team who are able to perform the given method

whoKnowsName

public java.lang.String whoKnowsName(java.lang.String name)
returns the name of the agent (first level of hierarchy below) who knows the given name (which can be in a "sublevel"). It is assumed that the name is necesseraly known.

Parameters:
name - the name to look for
Returns:
the name of the agent of the team who knows the given name