|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmadkit.kernel.AbstractAgent
madkit.kernel.Agent
madkit.chat.ChatAgent
public class ChatAgent
Titre : Chat Agent for MadKit Description : The Agent itself, used to control every pieces of the project. Copyright : Copyright (c) 2002 Société : UMII
Constructor Summary | |
---|---|
ChatAgent()
|
Method Summary | |
---|---|
void |
activate()
This method is initially called when the micro-kernel registers the agent. |
void |
addChannelForChatter(java.lang.String newCh)
Set the role of the chatter to "admin" or "chatter" |
boolean |
addCouple(java.lang.String name,
Channel ch,
int nbrUsers)
Add a couple (Channelname,Channel) in the hashtable nameChannel |
boolean |
addCouple(java.lang.String nick,
Chatter ch)
Add a couple (Nickname,Chatter) in the hashtable nickChatter |
void |
allowFunctions()
Allow or not to use chat functions if the chatter is normal or Admin |
boolean |
doesAdminExist()
Answer true if an admin is detected, else false |
void |
end()
This method is called by the agent micro-kernel at the end of the agent lifecycle. |
void |
endChannel(AgentAddress newAdmin)
|
boolean |
filterChatMessage(java.lang.String s,
Message m)
Allows ChatAgent to filter its own command, return true if the message is a command |
void |
firstThingsToDo()
|
java.lang.String |
getChannelAdminName(java.lang.String ch)
Get the admin 's name from the channel's name |
int |
getChannelNbrUsers(java.lang.String chName)
get the number of user for a selected channel |
java.lang.String[] |
getChannelsAdminNamesList()
Get a string tab of the channels admins name |
java.lang.String[] |
getChannelsNamesList()
Get a string tab of the channels names |
java.lang.String[] |
getChannelsNbrUsersList()
Get a string tab of the channels numbers of users |
java.lang.String[] |
getChannelsTopicsList()
Get a string tab of the channels topics |
java.lang.String |
getChannelTopic(java.lang.String ch)
Get the topic from the channel's name |
java.lang.String |
getChatter()
|
AgentAddress |
getChatterAddress(java.lang.String nickname)
Get the AgentAddress from the chatter's nickname |
java.lang.String |
getChatterAddressInString(java.lang.String nickname)
Get the AgentAddress from the chatter's nickname, return a String |
AgentAddress[] |
getChatterAddressList()
Get a AgentAddress list of the chatter |
java.lang.String |
getChatterEmailInString(java.lang.String nickname)
Get the E-Mail from the chatter's nickname, return a String |
Chatter[] |
getChatterListWhoseAreInAChannel(java.lang.String ch_)
Get chatters AgentAddress List for a choosen channel, RETURN INSTANCES OF CHATTER !! |
java.lang.String |
getChatterNickInString(java.lang.String nickname)
Get the E-Mail from the chatter's nickname, return a String |
java.lang.String |
getChatterRole(java.lang.String n)
Get the role of the chatter to "admin" or "chatter" |
Chatter |
getChatterThanksAgentAddress(AgentAddress agAd)
Get the chatter instance that correspond to the agent address |
java.lang.String[] |
getEmailList()
Get a string tab of the chatters email |
java.lang.String[] |
getNamesList()
Get a string tab of the chatters names |
java.lang.String[] |
getRoleList()
Get a string tab of the chatters Role |
java.lang.String[] |
getTabChatter()
|
void |
handleMessage(Message m)
|
void |
incrChannelNbrUsers(java.lang.String chName)
Increase the number of users of the selected channel by one |
void |
initGUI()
This method is called by the specific external graphic system (as the G-Box) to ask the agent to prepare a graphical interface. |
boolean |
isAdmin(java.lang.String chan_,
java.lang.String chat_)
Say if chatter is the channel's admin |
boolean |
isChatterInChannel(java.lang.String nick_,
java.lang.String ch_)
Is chatter in this channel |
void |
live()
This method defines the main behavior for threaded agents. |
void |
printAdrNick()
Print all the couple (Nickname,AgentAddress) |
void |
println(java.lang.String s)
Prints text information in a environment-independant way (GUI, console, ...) |
void |
printnameChannel()
Print on the std output the nameChannel hashtable content |
void |
printnickChatter()
Print on the std output the nickChatter hashtable content |
void |
printNickChatter()
Print the nickChatter hashtable on the stdoutput |
void |
printTabString(java.lang.String[] tabStr)
|
void |
removeChannel(java.lang.String n)
|
boolean |
removeChatter(java.lang.String nickname)
Remove the couple (Nickname,AgentAddress) in the hashtable, return true if the job is well done |
void |
sendAddChannel(java.lang.String chName)
Send #ADDNEWCHANNEL msg |
void |
sendAdminHashtable(AgentAddress a)
Not optimized method, send the content of the nickChatter hashtable |
void |
sendAdminHashtableObject(AgentAddress a)
Optimized method, send the object : nickChatter hashtable |
void |
sendBan(java.lang.String n)
Send #BAN msg |
void |
sendChannelHashtableObject(AgentAddress a)
Optimized method, send the object : nickChatter hashtable |
void |
sendChatMessage(java.lang.String s)
|
void |
sendChatMessage(java.lang.String s,
java.lang.String channel)
|
void |
sendGetTable()
Send gettable msg |
void |
sendKick(java.lang.String n)
Send #KICK msg |
void |
sendMAJNbrUsrersOfChannel(java.lang.String chName)
Send #MAJNBRUSRCHANNEL msg |
void |
sendQuerry(AgentAddress ad,
java.lang.String n)
Send query msg |
void |
sendRemoveChannel(java.lang.String chName)
Send #REMOVECHANNEL msg |
void |
sendToAllNoneAdmin()
Send the hashtable thanks to the optimized method to all the none "Admin" chatter |
void |
sendTopic(java.lang.String n,
java.lang.String t)
Send #TOPIC msg |
void |
sendUnique()
Send #UNIQUE msg |
void |
setChannelNbrUsers(java.lang.String chName,
int nbr)
Set the number of user for a selected channel |
void |
setChannelRole(java.lang.String n)
Set the name of the admin to chatter for a chosen channel |
void |
setChatter(java.lang.String s)
|
void |
setChatterRole(java.lang.String r)
Set the role of the chatter to "admin" or "chatter" |
void |
upDateNickname()
Update the chatter tNames textArea thanks to the nickChatter hashtable |
Methods inherited from class madkit.kernel.Agent |
---|
connectAgencyToAgency, createPlace, createPlace, enableMobility, enableMobility, exitImmediatlyOnKill, getAgencyNamed, joinPlace, joinPlace, joinPlace, pause, receiveMessage, run, waitNextMessage, waitNextMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChatAgent()
Method Detail |
---|
public void setChatter(java.lang.String s)
public java.lang.String getChatter()
public java.lang.String[] getTabChatter()
public void initGUI()
AbstractAgent
initGUI
in class AbstractAgent
public void activate()
AbstractAgent
activate
in class AbstractAgent
public void live()
Agent
live
in class Agent
public void firstThingsToDo()
public void end()
AbstractAgent
end
in class AbstractAgent
public void endChannel(AgentAddress newAdmin)
public boolean isAdmin(java.lang.String chan_, java.lang.String chat_)
public void println(java.lang.String s)
AbstractAgent
println
in class AbstractAgent
public void handleMessage(Message m)
public void printTabString(java.lang.String[] tabStr)
public void allowFunctions()
public boolean doesAdminExist()
public void sendChatMessage(java.lang.String s)
public void sendChatMessage(java.lang.String s, java.lang.String channel)
public boolean filterChatMessage(java.lang.String s, Message m)
public void sendToAllNoneAdmin()
public void sendAdminHashtable(AgentAddress a)
public void sendAdminHashtableObject(AgentAddress a)
public void sendChannelHashtableObject(AgentAddress a)
public void upDateNickname()
public void printnickChatter()
public void printnameChannel()
public boolean addCouple(java.lang.String nick, Chatter ch)
public void setChatterRole(java.lang.String r)
public void addChannelForChatter(java.lang.String newCh)
public java.lang.String getChatterRole(java.lang.String n)
public void printNickChatter()
public AgentAddress getChatterAddress(java.lang.String nickname)
public AgentAddress[] getChatterAddressList()
public java.lang.String getChatterAddressInString(java.lang.String nickname)
public java.lang.String getChatterEmailInString(java.lang.String nickname)
public java.lang.String getChatterNickInString(java.lang.String nickname)
public Chatter getChatterThanksAgentAddress(AgentAddress agAd)
public boolean isChatterInChannel(java.lang.String nick_, java.lang.String ch_)
public java.lang.String[] getNamesList()
public java.lang.String[] getEmailList()
public java.lang.String[] getRoleList()
public Chatter[] getChatterListWhoseAreInAChannel(java.lang.String ch_)
public boolean removeChatter(java.lang.String nickname)
public void printAdrNick()
public boolean addCouple(java.lang.String name, Channel ch, int nbrUsers)
public java.lang.String getChannelTopic(java.lang.String ch)
public java.lang.String getChannelAdminName(java.lang.String ch)
public void setChannelRole(java.lang.String n)
public void setChannelNbrUsers(java.lang.String chName, int nbr)
public int getChannelNbrUsers(java.lang.String chName)
public void incrChannelNbrUsers(java.lang.String chName)
public java.lang.String[] getChannelsNamesList()
public java.lang.String[] getChannelsTopicsList()
public java.lang.String[] getChannelsNbrUsersList()
public java.lang.String[] getChannelsAdminNamesList()
public void removeChannel(java.lang.String n)
public void sendQuerry(AgentAddress ad, java.lang.String n)
public void sendGetTable()
public void sendKick(java.lang.String n)
public void sendBan(java.lang.String n)
public void sendTopic(java.lang.String n, java.lang.String t)
public void sendUnique()
public void sendAddChannel(java.lang.String chName)
public void sendMAJNbrUsrersOfChannel(java.lang.String chName)
public void sendRemoveChannel(java.lang.String chName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |