jp.ac.nagoyau.is.ss.kishii.suntori.message.components
Class AbstractCSAgent<E extends rescuecore2.standard.entities.StandardEntity>

java.lang.Object
  extended by rescuecore2.components.AbstractComponent<T>
      extended by rescuecore2.components.AbstractAgent<rescuecore2.standard.entities.StandardWorldModel,E>
          extended by rescuecore2.standard.components.StandardAgent<E>
              extended by jp.ac.nagoyau.is.ss.kishii.suntori.message.components.AbstractCSAgent<E>
Type Parameters:
E -
All Implemented Interfaces:
rescuecore2.components.Agent, rescuecore2.components.Component

public abstract class AbstractCSAgent<E extends rescuecore2.standard.entities.StandardEntity>
extends rescuecore2.standard.components.StandardAgent<E>

The AbstractCSAgent show the Agent using this communication library.

Author:
takefumi

Field Summary
protected  java.util.List<RCRSCSMessage> receivedMessageList
           
 
Fields inherited from class rescuecore2.components.AbstractComponent
config, connection, model, random
 
Constructor Summary
AbstractCSAgent()
          Constructor
 
Method Summary
protected  void addMessage(RCRSCSMessage message)
          Add sended message.
protected  int getMessageChannel()
          Get the using message channel.
protected  void postConnect()
           
protected  void receiveMessage(java.util.Collection<rescuecore2.messages.Command> heard)
          Receive messages.
In this method, only messages sended from the set channel will be converted.
protected  void sendMessage(int time)
          Send message by using the set channel.
protected  void sendSpeak(int time, int channel, byte[] data)
           
protected  void setMessageChannel(int channel)
          Set the message channel used in sending messages.
protected  void think(int time, rescuecore2.worldmodel.ChangeSet changed, java.util.Collection<rescuecore2.messages.Command> heard)
           
protected abstract  void thinking(int time, rescuecore2.worldmodel.ChangeSet changed, java.util.Collection<rescuecore2.messages.Command> heard)
          Development part that have to be created by users.
At this point,we already receive messages from other Agents.
 
Methods inherited from class rescuecore2.standard.components.StandardAgent
createWorldModel, getRefuges, getRequestedEntityURNs, getRequestedEntityURNsEnum, location, sendClear, sendExtinguish, sendLoad, sendMove, sendMove, sendRescue, sendRest, sendSay, sendSubscribe, sendTell, sendUnload, shouldIndex
 
Methods inherited from class rescuecore2.components.AbstractAgent
connect, getID, getPreferredNDC, me, postConnect, processMessage, processSense
 
Methods inherited from class rescuecore2.components.AbstractComponent
getName, getPreferredLogContext, getPreferredRegistry, initialise, postConnect, processImmediately, send, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface rescuecore2.components.Component
getName, getPreferredLogContext, getPreferredRegistry, initialise, shutdown
 

Field Detail

receivedMessageList

protected java.util.List<RCRSCSMessage> receivedMessageList
Constructor Detail

AbstractCSAgent

public AbstractCSAgent()
Constructor

Method Detail

think

protected final void think(int time,
                           rescuecore2.worldmodel.ChangeSet changed,
                           java.util.Collection<rescuecore2.messages.Command> heard)
Specified by:
think in class rescuecore2.components.AbstractAgent<rescuecore2.standard.entities.StandardWorldModel,E extends rescuecore2.standard.entities.StandardEntity>

thinking

protected abstract void thinking(int time,
                                 rescuecore2.worldmodel.ChangeSet changed,
                                 java.util.Collection<rescuecore2.messages.Command> heard)
Development part that have to be created by users.
At this point,we already receive messages from other Agents. Received messages are in 'receivedMessageList'.


postConnect

protected void postConnect()
Overrides:
postConnect in class rescuecore2.standard.components.StandardAgent<E extends rescuecore2.standard.entities.StandardEntity>

setMessageChannel

protected final void setMessageChannel(int channel)
Set the message channel used in sending messages.

Parameters:
channel -

getMessageChannel

protected final int getMessageChannel()
Get the using message channel.

Returns:
channel

receiveMessage

protected final void receiveMessage(java.util.Collection<rescuecore2.messages.Command> heard)
Receive messages.
In this method, only messages sended from the set channel will be converted.

Parameters:
heard -

addMessage

protected final void addMessage(RCRSCSMessage message)
Add sended message.

Parameters:
message -

sendMessage

protected final void sendMessage(int time)
Send message by using the set channel.

Parameters:
time -

sendSpeak

protected final void sendSpeak(int time,
                               int channel,
                               byte[] data)
Overrides:
sendSpeak in class rescuecore2.standard.components.StandardAgent<E extends rescuecore2.standard.entities.StandardEntity>