Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.ispace
Class ContactManager

    java.lang.Object
      ix.ispace.ContactManager

    public class ContactManager

extends java.lang.Object

Keeps track of known relationships between agents and agent capabilities.

Field Summary
`protected java.util.List` | `agentData`
`protected ColorGenerator` | `colorGen`
`protected java.util.List` | `groups`
`protected java.util.List` | `listeners`
`protected java.util.Map` | `nameToGroup`
`protected MultiMap` | `relMap`

Constructor Summary
`ContactManager()`

Method Summary
`void` | `addAgent(java.lang.String name)` Adds the agent as a contact.
`void` | `addAgent(java.lang.String name, AgentRelationship rel)` Adds the agent, recording it as having the specified relationship to this agent.
`void` | `addAgentGroup(AgentGroup group)`
`void` | `addAgents(java.util.List names, AgentRelationship rel)` Adds the agents by calling `addAgent(String, AgentRelationship)`.
`void` | `addContactListener(ContactListener listener)`
`protected void` | `addStandardAgentGroups()`
`void` | `changeRelationship(java.lang.String name, AgentRelationship newRel)`
`void` | `deleteAgent(java.lang.String name)`
`boolean` | `ensureAgent(java.lang.String name, AgentRelationship rel)` Ensures that the agent is recorded as having the specified relationship to this agent.
`void` | `fireContactChange(AgentData oldData, AgentData newData)`
`void` | `fireContactDeleted(AgentData data)`
`void` | `fireContactEvent(ContactEvent event)`
`void` | `fireNewContact(AgentData data)`
`java.awt.Color` | `getAgentColor(java.lang.String name)`
`java.awt.Color` | `getAgentColor(java.lang.String name, java.awt.Color defaultColor)`
`java.util.List` | `getAgentData()`
`java.util.List` | `getAgentData(AgentRelationship rel)`
`java.util.List` | `getAgentData(Capability c)`
`java.util.List` | `getAgentData(Capability c, boolean defaultIfUnknown)`
`AgentData` | `getAgentData(java.lang.String name)`
`AgentGroup` | `getAgentGroup(java.lang.String name)`
`java.util.Collection` | `getAgentGroups()`
`java.util.List` | `getSortedNameList()`
`void` | `noteAgent(java.lang.String name)` Record the agent as a contact if it is not already known.
`void` | `noteAgent(java.lang.String name, AgentRelationship assumedRel)` Record the agent as having the specified relationship to this agent, if the agent is not already known.
`void` | `processCommandLineArguments()` Process command-line arguments that are about our relationships with other agents.
`protected void` | `replaceAgentData(AgentData oldData, AgentData newData)`
`void` | `setAgentColor(java.lang.String name, java.awt.Color color)`
`void` | `setCapabilities(java.lang.String name, java.util.List newCapabilities)`
`protected void` | `warnAboutQuestionableAgentNames(java.util.List names, AgentRelationship rel)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### listeners

    protected java.util.List listeners

### agentData

    protected java.util.List agentData

### relMap

    protected MultiMap relMap

### groups

    protected java.util.List groups

### nameToGroup

    protected java.util.Map nameToGroup

### colorGen

    protected ColorGenerator colorGen

Constructor Detail

### ContactManager

    public ContactManager()

Method Detail

### addAgent

    public void addAgent(java.lang.String name)

  Adds the agent as a contact.

  Throws:
    `AssertionFailure` - if the agent is already known.
  See Also:
    `addAgent(String, AgentRelationship)`

### addAgent

    public void addAgent(java.lang.String name,
                         AgentRelationship rel)

  Adds the agent, recording it as having the specified relationship to this agent.

  Throws:
    `AssertionFailure` - if the agent is already known.

### addAgents

    public void addAgents(java.util.List names,
                          AgentRelationship rel)

  Adds the agents by calling `addAgent(String, AgentRelationship)`.

  Throws:
    `AssertionFailure` - if any of the agents is already known.
  See Also:
    `noteAgent(String, AgentRelationship)`, `ensureAgent(String, AgentRelationship)`

### noteAgent

    public void noteAgent(java.lang.String name)

  Record the agent as a contact if it is not already known. This makes it easier to reply to agents that have sent things to us, e.g. by putting their name in menus of agents that might be sent to.

  See Also:
    `noteAgent(String, AgentRelationship)`

### noteAgent

    public void noteAgent(java.lang.String name,
                          AgentRelationship assumedRel)

  Record the agent as having the specified relationship to this agent, if the agent is not already known. The relationship parameter is only an assumption or default, so if the agent is already known, this method will not change its relationship.

  See Also:
    `addAgent(String, AgentRelationship)`, `ensureAgent(String, AgentRelationship)`

### ensureAgent

    public boolean ensureAgent(java.lang.String name,
                               AgentRelationship rel)

  Ensures that the agent is recorded as having the specified relationship to this agent. The agent is added is it is not already known; otherwise the agent's relationship is changed.

  Returns:
    true if the agent was not already known and hence had to be added.
  See Also:
    `noteAgent(String, AgentRelationship)`, `addAgent(String, AgentRelationship)`, `changeRelationship(String, AgentRelationship)`

### getAgentData

    public java.util.List getAgentData()

### getAgentData

    public AgentData getAgentData(java.lang.String name)

### getAgentData

    public java.util.List getAgentData(AgentRelationship rel)

### getAgentData

    public java.util.List getAgentData(Capability c)

### getAgentData

    public java.util.List getAgentData(Capability c,
                                       boolean defaultIfUnknown)

### getSortedNameList

    public java.util.List getSortedNameList()

### replaceAgentData

    protected void replaceAgentData(AgentData oldData,
                                    AgentData newData)

### changeRelationship

    public void changeRelationship(java.lang.String name,
                                   AgentRelationship newRel)

### deleteAgent

    public void deleteAgent(java.lang.String name)

### setCapabilities

    public void setCapabilities(java.lang.String name,
                                java.util.List newCapabilities)

### getAgentColor

    public java.awt.Color getAgentColor(java.lang.String name)

### getAgentColor

    public java.awt.Color getAgentColor(java.lang.String name,
                                        java.awt.Color defaultColor)

### setAgentColor

    public void setAgentColor(java.lang.String name,
                              java.awt.Color color)

### getAgentGroups

    public java.util.Collection getAgentGroups()

### getAgentGroup

    public AgentGroup getAgentGroup(java.lang.String name)

### addAgentGroup

    public void addAgentGroup(AgentGroup group)

### addStandardAgentGroups

    protected void addStandardAgentGroups()

### processCommandLineArguments

    public void processCommandLineArguments()

  Process command-line arguments that are about our relationships with other agents.

  For each AgentRelationship, R, R+"s" is treated as a parameter whose value should be a comma-separated list of names.

  Simple capabilities can be given by

          -external-capabilities=ipcName:verb, ...

  See Also:
    `AgentRelationship`

### warnAboutQuestionableAgentNames

    protected void warnAboutQuestionableAgentNames(java.util.List names,
                                                   AgentRelationship rel)

### addContactListener

    public void addContactListener(ContactListener listener)

### fireNewContact

    public void fireNewContact(AgentData data)

### fireContactDeleted

    public void fireContactDeleted(AgentData data)

### fireContactChange

    public void fireContactChange(AgentData oldData,
                                  AgentData newData)

### fireContactEvent

    public void fireContactEvent(ContactEvent event)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD