Class Book

java.lang.Object
  |
  +--Book
All Implemented Interfaces:
java.io.Serializable

public class Book
extends java.lang.Object
implements java.io.Serializable

This class is the address book an agent maintains in order to communicate and build its "community". It stores the name of agents it communicates with, a counter that keeps track of the story of the interactions, methods to add to and delete from the address book.

Since:
JDK 1.3
See Also:
Serialized Form

Field Summary
private  Slot[] addressSet
          the array of addresses, each slot containing the name of an agent and its exchange activity record.
private  int addressSetSize
          the size of the address book
private  Slot slot
          a slot of the address book
 
Constructor Summary
Book(AgentsPopulations population)
          construct an address book
 
Method Summary
 void addToAddressBook(Agent agent)
          Add an agent to the address book if it participates in the communication
 boolean deleteAddress(Slot slot)
          delete an agent from the address book if it has not exchanged initExval times in a raw.
 int getAddBookSize()
          return the size of the address book
 Slot[] getAddressSet()
          return the set of agents in the address book
 Slot[] ordering()
          Classes the address Book by decreasing time of presence in the address book.
 void transferAddressBook(Agent agent)
          If an agent receives an answer from another agent, then in turn it transfers to this agent the highest part of its address book, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

slot

private Slot slot
a slot of the address book


addressSet

private Slot[] addressSet
the array of addresses, each slot containing the name of an agent and its exchange activity record.


addressSetSize

private int addressSetSize
the size of the address book

Constructor Detail

Book

public Book(AgentsPopulations population)
construct an address book

Parameters:
population - The whole population of agents involved in the experiment
Method Detail

getAddBookSize

public int getAddBookSize()
return the size of the address book


getAddressSet

public Slot[] getAddressSet()
return the set of agents in the address book


deleteAddress

public boolean deleteAddress(Slot slot)
delete an agent from the address book if it has not exchanged initExval times in a raw.

Parameters:
slot - The position of the agent to be deleted from the address book in the array storing the addresses of agents

addToAddressBook

public void addToAddressBook(Agent agent)
Add an agent to the address book if it participates in the communication

Parameters:
agent - The to be added agent

transferAddressBook

public void transferAddressBook(Agent agent)
If an agent receives an answer from another agent, then in turn it transfers to this agent the highest part of its address book, i.e. the two best correspondents of its book. This routine features the know-who exchange (Lundvall et Johnson, 1994)

Parameters:
agent - The agent to whom the addresses are passed to
See Also:
ordering()

ordering

public Slot[] ordering()
Classes the address Book by decreasing time of presence in the address book. Agents with highest time are the most reliable correspondants.