jxtaimpl
Class NeighbourManager

java.lang.Object
  |
  +--jxtaimpl.NeighbourManager
All Implemented Interfaces:
Clearable, Serializable

public class NeighbourManager
extends Object
implements Clearable, Serializable

This synchronized class is used as a repository for storing information about this nest's neighbourhood. This class has to be instantiated by the AnthillPeerWS, and a reference to the instance itself has to be passed to the Nest instance (see sequence diagrams for more)

See Also:
Serialized Form

Constructor Summary
NeighbourManager()
          Defaul constructor
 
Method Summary
protected  void addNeighbour(NestId id)
          A new Neighbour instance is created using the given NestId and added to the internal data structure using the NestId as key value.
 void clear()
          This method cleans up the cache of neighbours managed by the NeighbourManager instance
protected  Object removeNeighbour(NestId id)
          This method removes the neighbour entry associated with the specified id.
protected  int size()
          Return the number of elements stored
protected  Neighbour[] toArray()
          Return the values contained in this set, shaped as an array of Neighbours
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeighbourManager

public NeighbourManager()
Defaul constructor

Method Detail

clear

public void clear()
This method cleans up the cache of neighbours managed by the NeighbourManager instance

Specified by:
clear in interface Clearable

addNeighbour

protected void addNeighbour(NestId id)
A new Neighbour instance is created using the given NestId and added to the internal data structure using the NestId as key value. When adding new entries this method checks whether there is already a key of the same value or not, in order to avoid duplicates

Parameters:
id - The ID to be added to the set of known neighbours

removeNeighbour

protected Object removeNeighbour(NestId id)
This method removes the neighbour entry associated with the specified id. It will return null if and only if the specified id is unknown

Parameters:
id - The ID of the Nest to be removed from the set of known neighbours

toArray

protected Neighbour[] toArray()
Return the values contained in this set, shaped as an array of Neighbours


size

protected int size()
Return the number of elements stored