using AgentService.Agent;
using AgentService.Agent.Runtime;
using AgentService.Agent.Behaviour;
using AgentService.Agent.Knowledge;
using AgentService.Platform.AMS;
namespace TestMessaging
{
///
/// Knowledge MessageData. Mantains
/// information about messages
/// exchanged between two agents.
///
public class MessageData : Knowledge
{
///
/// Getter for the MaxMessages property. The MaxMessages is
/// used to store the number of messages sent during the test
/// from the agent which starts the game.
///
/// Instance of the behaviour that requests the access.
/// the property value.
[KnowledgeItem("MaxMessages", typeof(int), true)]
public int GetMaxMessages(Behaviour lockingBehaviour)
{
return (int)this["MaxMessages", lockingBehaviour];
}
///
/// Setter for the MaxMessages property. The MaxMessages is
/// used to store the number of messages sent during the test
/// from the agent which starts the game.
///
/// Instance of the behaviour
/// that requests the access.
/// the property value.
[KnowledgeItem("MaxMessages", typeof(int), false)]
public int SetMaxMessages(Behaviour lockingBehaviour, int value)
{
this["MaxMessages", lockingBehaviour] = value;
return (int)this["MaxMessages", lockingBehaviour];
}
///
/// Getter for the ReplyAdd property. The ReplyAdd flag to
/// control the reply behaviour of the agent, if true the
/// number initially sent is incremented.
///
/// Instance of the behaviour
/// that requests the access.
/// the property value.
[KnowledgeItem("ReplyAdd", typeof(bool), true)]
public bool GetReplyAdd(Behaviour lockingBehaviour)
{
return (bool)this["ReplyAdd", lockingBehaviour];
}
///
/// Setter for the ReplyAdd property. The ReplyAdd flag to
/// control the reply behaviour of the agent, if true the
/// number initially sent is incremented.
///
/// Instance of the behaviour
/// that requests the access.
/// the property value.
[KnowledgeItem("ReplyAdd", typeof(int), false)]
public bool SetReplyAdd(Behaviour lockingBehaviour, bool value)
{
this["ReplyAdd", lockingBehaviour] = value;
return (bool)this["ReplyAdd", lockingBehaviour];
}
///
/// Getter for the PeerName property. The PeerName is
/// used to store the name of the agent to send
/// messages to.
///
/// Instance of the behaviour
/// that requests the access.
/// the property value.
[KnowledgeItem("PeerName", typeof(string), true)]
public string GetPeerName(Behaviour lockingBehaviour)
{
return this["PeerName", lockingBehaviour] as string;
}
///
/// Setter for the PeerName property. The PeerName is
/// used to store the name of the agent to send
/// messages to.
///
/// Instance of the behaviour
/// that requests the access.
/// the property value.
/// the new property value.
[KnowledgeItem("PeerName", typeof(string), false)]
public string SetPeerName(Behaviour lockingBehaviour, string value)
{
this["PeerName", lockingBehaviour] = value;
return this["PeerName", lockingBehaviour] as string;
}
///
/// Deserialization constructor.
///
public MessageData()
{
//
// TODO: Add constructor logic here
//
}
///
/// Creates an instance of the ConvData knowledge.
///
/// knowledge name
/// persistence mode
/// name of the peer agent
/// number of messages sent by the agent who started the game
/// reply behaviour
public MessageData(string name, PersistenceMode pMode, int maxMessages, bool bReplyAdd, string peerName) : base(name, pMode)
{
this.AddItem("PeerName", typeof(string), peerName);
this.AddItem("MaxMessages", typeof(int), maxMessages);
this.AddItem("ReplyAdd", typeof(bool), bReplyAdd);
}
}
}