|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectes.upv.dsic.gti_ia.cAgents.CProcessor
public class CProcessor
CProcessors manage conversations. Each conversation is managed by a different CProcessor. CProcessors are created by CFactories, also a CProcessor can act as a template and be associated to a CFactory. Every CProcessor has a graph associated, this graph specifies the states of the conversation and their transitions.
| Constructor Summary | |
|---|---|
protected |
CProcessor(CAgent myAgent)
Creates a new CProcessor associated to an agent |
| Method Summary | |
|---|---|
protected void |
addMessage(ACLMessage msg)
Assigns a message to this CProcessor |
void |
addTransition(State from,
State destination)
Adds a transition between two states |
void |
addTransition(String from,
String destination)
Adds a transition between two states |
protected BeginState |
beginState()
Returns the name of the first state |
protected es.upv.dsic.gti_ia.cAgents.CancelState |
cancelState()
Returns the name of the exception cancel state |
int |
cleanMessagesQueue(String agentID,
String headerTitle,
ArrayList<String> headerContents)
Deletes the messages from the messageQueue that have the given agentID (as sender), header title and the contents of this header |
Object |
clone()
Clones this object |
void |
createAsyncConversation(ACLMessage initalMessage)
Creates a asynchronous CProcessor |
ACLMessage |
createSyncConversation(ACLMessage initalMessage)
Creates a synchronous conversation where this agent is the initiator |
ACLMessage |
createSyncConversation(CFactory factory,
String id)
Creates a synchronous conversation, in this conversation this agent is the initiator |
void |
deregisterState(State s)
Removes a state from the graph |
String |
getConversationID()
Gets conversation identifier |
Map<String,Object> |
getInternalData()
Gets conversation's internal data |
ACLMessage |
getLastReceivedMessage()
Gets the last received message during this conversation |
ACLMessage |
getLastSentMessage()
Gets the last sent message during this conversation |
CAgent |
getMyAgent()
Returns the agent owner of this CProcessor |
CFactory |
getMyFactory()
Returns the factory that has associated this CProcessor |
CProcessor |
getParent()
Returns the CProcessor which is parent of this one |
Map<String,Object> |
getParentInternalData()
Returns parent internal data |
State |
getState(String name)
Returns the state identified by its name |
TransitionTable |
getTransitionTable()
Returns the table of transitions between the states of the graph |
boolean |
isIdle()
Returns true if the CProcessor is idle, false otherwise |
protected boolean |
isInitiator()
Returns whether the CProcessor is initiator |
boolean |
isTerminated()
Returns true if the CProcessor is terminated, false otherwise |
protected String |
newConversationID()
Returns a new conversation identifier |
void |
registerFirstState(State s)
Registers the first state of the graph |
void |
registerState(State s)
Registers a new state in the CProcessor |
void |
removeTransition(String from,
String destination)
Removes a transition between from state and destination state |
void |
run()
This method executes the CProcessor thread. |
protected es.upv.dsic.gti_ia.cAgents.SendingErrorsState |
sendingErrorsState()
Returns the exception state that manages sending errors |
protected void |
setConversationID(String id)
Sets the conversation identifier |
protected void |
setFactory(CFactory factory)
Sets the factory to which this CProcessor is associated |
protected void |
setIdle(boolean idle)
Sets the CProcessor as idle |
protected void |
setInitiator(boolean initiator)
Sets the CProcessor as initiator or participant |
protected void |
setIsSynchronized(boolean synchronization)
Sets the CProcessor as synchronous or asynchronous |
protected void |
setParent(CProcessor parent)
Sets the parent CProcessor of this one |
void |
ShutdownAgent()
Tries to end agent execution |
void |
unlockMyAgent()
Unlocks the mutex of the agent owner of this CProcessor |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected CProcessor(CAgent myAgent)
myAgent - The associated agent| Method Detail |
|---|
public void addTransition(String from,
String destination)
from - name of the from statedestination - name of the destination state
public void addTransition(State from,
State destination)
from - statedestination - statepublic void createAsyncConversation(ACLMessage initalMessage)
initalMessage - first message received in this conversation,
i.e. the message which started the conversationpublic ACLMessage createSyncConversation(ACLMessage initalMessage)
initalMessage - The message that will be sent as the first message of the conversation
public ACLMessage createSyncConversation(CFactory factory,
String id)
factory - Factory that will create the conversationid - Conversation id
public void deregisterState(State s)
s - State to removepublic String getConversationID()
public Map<String,Object> getInternalData()
public ACLMessage getLastReceivedMessage()
public ACLMessage getLastSentMessage()
public CAgent getMyAgent()
public CProcessor getParent()
public Map<String,Object> getParentInternalData()
public State getState(String name)
name - of the state
public TransitionTable getTransitionTable()
public void registerState(State s)
s - The new state
public void removeTransition(String from,
String destination)
from - name of the form statedestination - name of the destination statepublic void run()
run in interface Runnablepublic void ShutdownAgent()
public void unlockMyAgent()
public Object clone()
clone in class Objectprotected void addMessage(ACLMessage msg)
msg - message to be assigned
public int cleanMessagesQueue(String agentID,
String headerTitle,
ArrayList<String> headerContents)
agentID - of the senderheaderTitle - to search in the headers of the messagesheaderContents - of the given header title to delete the message from queue
protected BeginState beginState()
protected es.upv.dsic.gti_ia.cAgents.CancelState cancelState()
public CFactory getMyFactory()
public boolean isIdle()
public boolean isTerminated()
protected String newConversationID()
public void registerFirstState(State s)
s - the state to registerprotected es.upv.dsic.gti_ia.cAgents.SendingErrorsState sendingErrorsState()
protected void setConversationID(String id)
id - the conversation identifierprotected void setFactory(CFactory factory)
factory - to which this CProcessor will be associatedprotected void setIdle(boolean idle)
idle - true if you want to set it to idle, false otherwiseprotected void setIsSynchronized(boolean synchronization)
synchronization - true if you want to set it to synchronous, false otherwiseprotected void setParent(CProcessor parent)
parent - CProcessor of this oneprotected void setInitiator(boolean initiator)
initiator - true if you want to set it to initiator, false otherwiseprotected boolean isInitiator()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||