is.lill.acre.conversation
Class ConversationManager

java.lang.Object
  extended by java.util.Observable
      extended by is.lill.acre.conversation.ConversationManager
All Implemented Interfaces:
java.util.Observer

public class ConversationManager
extends java.util.Observable
implements java.util.Observer

Class for managing the conversations of one agent


Constructor Summary
ConversationManager(IACREAgentID ownerId)
           
 
Method Summary
 java.util.Map<java.lang.String,java.util.Set<Conversation>> getActiveByParticipant()
           
 Conversation getConversationByID(java.lang.String identifier)
           
 java.lang.String getNextConversationId()
          Generate the next unique conversation id - concatenate the agent ID of the owner of this manager to an incrementing counter
 IACREAgentID getOtherParticipant(Conversation c)
          From a conversation, find the participant that is not the agent that owns this conversation manager.
 boolean initiates(ProtocolDescriptor pd, IACREMessage m)
           
 Conversation processMessage(IACREMessage m)
          Process a message that has been sent/received This implements the Match, Fail, New and Update stages of the formal model
 void setProtocolManager(ProtocolManager pm)
           
 void update(java.util.Observable arg0, java.lang.Object arg1)
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversationManager

public ConversationManager(IACREAgentID ownerId)
Parameters:
ownerId -
Method Detail

update

public void update(java.util.Observable arg0,
                   java.lang.Object arg1)
Specified by:
update in interface java.util.Observer

getOtherParticipant

public IACREAgentID getOtherParticipant(Conversation c)
From a conversation, find the participant that is not the agent that owns this conversation manager.

Parameters:
c - A conversation
Returns:
The Agent id of the other participating agent in the conversation

getNextConversationId

public java.lang.String getNextConversationId()
Generate the next unique conversation id - concatenate the agent ID of the owner of this manager to an incrementing counter

Returns:
A uniquely generated conversation id

setProtocolManager

public void setProtocolManager(ProtocolManager pm)

getActiveByParticipant

public java.util.Map<java.lang.String,java.util.Set<Conversation>> getActiveByParticipant()

getConversationByID

public Conversation getConversationByID(java.lang.String identifier)

initiates

public boolean initiates(ProtocolDescriptor pd,
                         IACREMessage m)

processMessage

public Conversation processMessage(IACREMessage m)
Process a message that has been sent/received This implements the Match, Fail, New and Update stages of the formal model

Parameters:
m - A message that has been sent/received
Returns:
The conversation the message matches, or null if the message was either unmatched or ambiguous