Class skydata::internal::agents::SKAgent¶
ClassList > skydata > internal > agents > SKAgent
Inherits the following classes: Agent
Inherited by the following classes: skydata::internal::agents::SKD, skydata::internal::agents::SKHM
Public Attributes¶
Type | Name |
---|---|
Map< String, Object > | args = null |
Boolean | inDebug = false |
int | size |
long | startingDate = 0 |
Public Functions¶
Type | Name |
---|---|
void | addBehaviour (Behaviour wakerBehaviour) |
final void | addInternalUpdate (String type, SKAgentBehaviour b) |
void | afterClone () |
void | afterMove () |
void | blockMigrate () |
void | broadcast (BroadcastI broadCaster, SKLMessage message, Set< SKAID > agents) |
boolean | canMigrate () |
Set< SKAID > | connectedHarbours () |
final void | createStorageObject (String property, Serializable value) |
void | debug (String s) |
void | delete () |
void | doClone (Location loc, String newName) |
void | doMove (Location loc) |
HashMap< SKAID, HashMap< String, Comparable > > | getHarboursStats () |
HashMap< String, HashMap< String, SKLMessage > > | getMsgInfoBF () |
final SKAID | getRealSKAID () |
HashMap< String, HashMap< String, Long > > | getReceivedMsgs () |
final SKAID | getSKAID () |
long | getStartingDate () |
final Serializable | getStorageObject (String property) |
final boolean | hasStorageObject (String property) |
void | migrate (AID harbour) |
void | migrate (AID harbour, boolean forced) |
SKAID | myHarbour () |
void | print (String s) |
void | setMsgInfoBF (HashMap< String, HashMap< String, SKLMessage > > inf) |
SKLMessage | skReceive (MessageTemplate mt) |
void | skSendNormal (SKLMessage msg) |
void | skSendReliable (SKLMessage msg) |
void | unblockMigrate () |
Protected Attributes¶
Type | Name |
---|---|
Set< SKAID > | harbours |
HashMap< SKAID, HashMap< String, Comparable > > | harboursStats = new HashMap<SKAID, HashMap<String, Comparable>>() |
Boolean | inMigration |
Set< SKAID > | membersHarbour = new HashSet<SKAID>() |
SKAID | myAID |
int | nbBlockingMigrate = 0 |
Protected Functions¶
Type | Name |
---|---|
void | beforeMove () |
final void | internalUpdate (String type, Object o) |
final void | internalUpdate (String type) |
void | reset () |
void | run (String action) |
void | setup () |
void | setupStats () |
Detailed Description¶
Generic class to represent an agent.
An agent can communicate reliably with other agents. It can also migrate on different Harbour.
An agent is composed by many informations : * A list of harbours with their informations * A list of behaviour with storage * Some informations about the reliable communication protocol * State about the possibility of migration
Public Attributes Documentation¶
variable args¶
Map<String, Object> skydata.internal.agents.SKAgent.args;
Arguments passed at the creation of the agent
variable inDebug¶
Boolean skydata.internal.agents.SKAgent.inDebug;
True if some print of debugging must be done
variable size¶
int skydata.internal.agents.SKAgent.size;
Size of the agent
variable startingDate¶
long skydata.internal.agents.SKAgent.startingDate;
Time of the creation of the agent
Public Functions Documentation¶
function addBehaviour¶
inline void skydata::internal::agents::SKAgent::addBehaviour (
Behaviour wakerBehaviour
)
Function to called to add a behaviour to the agent
function addInternalUpdate¶
inline final void skydata::internal::agents::SKAgent::addInternalUpdate (
String type,
SKAgentBehaviour b
)
Add a callback to a specific tag.
Parameters:
type
: the tagb
: the callback
function afterClone¶
inline void skydata::internal::agents::SKAgent::afterClone ()
Function called just after a migration
function afterMove¶
inline void skydata::internal::agents::SKAgent::afterMove ()
This function is called when the migration is finished
function blockMigrate¶
inline void skydata::internal::agents::SKAgent::blockMigrate ()
Disable temporarily the migration of the agent
function broadcast¶
inline void skydata::internal::agents::SKAgent::broadcast (
BroadcastI broadCaster,
SKLMessage message,
Set< SKAID > agents
)
Function to call to broadcast a message to a list of agents.
There can be different type of broadcast : skydata.internal.message.NBroadcast
and skydata.internal.message.RSBroadcast
Parameters:
broadCaster
the type of broadcastmessage
: the message to broadcastagents
: the list of agents to broadcast
function canMigrate¶
inline boolean skydata::internal::agents::SKAgent::canMigrate ()
Verify if the agent can migrate
Returns:
boolean : true if the agent can migrate, else false
function connectedHarbours¶
inline Set< SKAID > skydata::internal::agents::SKAgent::connectedHarbours ()
Get the list of known harbours
Returns:
the list
function createStorageObject¶
inline final void skydata::internal::agents::SKAgent::createStorageObject (
String property,
Serializable value
)
Store permanently an object in the memory of the agent with a specific key
Parameters:
property
: the key of the valuevalue
: the value to store
function debug¶
inline void skydata::internal::agents::SKAgent::debug (
String s
)
Function to call to print a debug message
Parameters:
s
: the message
function delete¶
inline void skydata::internal::agents::SKAgent::delete ()
Function to called to delete the agent
function doClone¶
inline void skydata::internal::agents::SKAgent::doClone (
Location loc,
String newName
)
Function called when the migration really started
function doMove¶
inline void skydata::internal::agents::SKAgent::doMove (
Location loc
)
Function called during the migration process
Parameters:
loc
: the location of the new Harbour
function getHarboursStats¶
inline HashMap< SKAID, HashMap< String, Comparable > > skydata::internal::agents::SKAgent::getHarboursStats ()
Return statistics on known harbours
Returns:
statistics
function getMsgInfoBF¶
inline HashMap< String, HashMap< String, SKLMessage > > skydata::internal::agents::SKAgent::getMsgInfoBF ()
Get the buffer of messages for the reliably communication protocol
Returns:
the buffer
function getRealSKAID¶
inline final SKAID skydata::internal::agents::SKAgent::getRealSKAID ()
Return the real SKAID of the current agent
Returns:
SKAID
function getReceivedMsgs¶
inline HashMap< String, HashMap< String, Long > > skydata::internal::agents::SKAgent::getReceivedMsgs ()
Get the list of all message id received
Returns:
the list
function getSKAID¶
inline final SKAID skydata::internal::agents::SKAgent::getSKAID ()
Return a copy of the SKAID of the current agent
Returns:
SKAID
function getStartingDate¶
inline long skydata::internal::agents::SKAgent::getStartingDate ()
Return the starting date of the agent
Returns:
long : the starting date
function getStorageObject¶
inline final Serializable skydata::internal::agents::SKAgent::getStorageObject (
String property
)
Return the object stored in the memory of the agent identified by a key
Parameters:
property
: the key
Returns:
the object
function hasStorageObject¶
inline final boolean skydata::internal::agents::SKAgent::hasStorageObject (
String property
)
Verify if an object is stored in the memory of the agent
Parameters:
property
: the key of the object
Returns:
True if an object is stored, else false
function migrate [1/2]¶
inline void skydata::internal::agents::SKAgent::migrate (
AID harbour
)
Function to call to ask a migration on a new harbour
Parameters:
harbour
: the target harbour
function migrate [2/2]¶
inline void skydata::internal::agents::SKAgent::migrate (
AID harbour,
boolean forced
)
Function to call to ask or to force a migration on a new harbour.
Parameters:
harbour
: the target harbourforced
: true if the migration is forced. Else, the migration algorithm will be asked.
function myHarbour¶
inline SKAID skydata::internal::agents::SKAgent::myHarbour ()
Return the identity of the harbour which host the agent
Returns:
the current harbour
function print¶
inline void skydata::internal::agents::SKAgent::print (
String s
)
Function to call to print a log message
Parameters:
s
: the message
function setMsgInfoBF¶
inline void skydata::internal::agents::SKAgent::setMsgInfoBF (
HashMap< String, HashMap< String, SKLMessage > > inf
)
Set the buffer of messages for the reliably communication protocol
Parameters:
inf
: the new buffer
function skReceive¶
inline SKLMessage skydata::internal::agents::SKAgent::skReceive (
MessageTemplate mt
)
Function to call to receive a message according to a MessageTemplate
Parameters:
mt
: the MessageTemplate to match
Returns:
A message that match mt or null
function skSendNormal¶
inline void skydata::internal::agents::SKAgent::skSendNormal (
SKLMessage msg
)
Function to call to send a message not reliably
Parameters:
msg
: the message to send
function skSendReliable¶
inline void skydata::internal::agents::SKAgent::skSendReliable (
SKLMessage msg
)
Function to call to send reliably a message
Parameters:
msg
: the message
function unblockMigrate¶
inline void skydata::internal::agents::SKAgent::unblockMigrate ()
Reenable the migration of the agent
Protected Attributes Documentation¶
variable harbours¶
Set<SKAID> skydata.internal.agents.SKAgent.harbours;
List of the known harbours
variable harboursStats¶
HashMap<SKAID, HashMap<String, Comparable> > skydata.internal.agents.SKAgent.harboursStats;
Stats on the known harbours
variable inMigration¶
Boolean skydata.internal.agents.SKAgent.inMigration;
True if the agent is migrating
variable membersHarbour¶
Set<SKAID> skydata.internal.agents.SKAgent.membersHarbour;
List of the family members which are on the same Harbours
variable myAID¶
SKAID skydata.internal.agents.SKAgent.myAID;
SKAID of the agent
variable nbBlockingMigrate¶
int skydata.internal.agents.SKAgent.nbBlockingMigrate;
If the agent cannot migrate, this number is greater than 0
Protected Functions Documentation¶
function beforeMove¶
inline void skydata::internal::agents::SKAgent::beforeMove ()
This function is called juste before the migration
function internalUpdate [1/2]¶
inline final void skydata::internal::agents::SKAgent::internalUpdate (
String type,
Object o
)
Throw an internal update with parameters.
For example, you can use these tags (see full documentation for all tags) : AFTER_MIGRATION : just after a migration AFTER_REPLICATION : just after a replication FAMILY_UPDATE : when the family is updated ...
Parameters:
type
: name of the internal updateo
: parameters to pass to callback
function internalUpdate [2/2]¶
inline final void skydata::internal::agents::SKAgent::internalUpdate (
String type
)
Throw an internal update without parameters.
SKAgent.internalUpdate
Parameters:
type
function reset¶
inline void skydata::internal::agents::SKAgent::reset ()
Reset an agent. This function is also called after a replication
function run¶
inline void skydata::internal::agents::SKAgent::run (
String action
)
Function called to start a new behaviour (with its name)
Parameters:
action
: the name of the behaviour
function setup¶
inline void skydata::internal::agents::SKAgent::setup ()
Initialize the agent for the first time
function setupStats¶
inline void skydata::internal::agents::SKAgent::setupStats ()
Initialize the process to update regularly the stats from the known harbours
The documentation for this class was generated from the following file /home/maxime/Desktop/skd_proto_v2/skd/src/main/java/skydata/internal/agents/SKAgent.java