freenetant
Class FreenetAntPheromone

java.lang.Object
  |
  +--freenetant.FreenetAntPheromone

public class FreenetAntPheromone
extends java.lang.Object

Version:
$Revision$
Author:
Andrea Piergallini, Luca Vagnozzi

Constructor Summary
FreenetAntPheromone()
           
FreenetAntPheromone(int capacity)
           
 
Method Summary
 boolean addKeyhash(KeyHash keyhash, NestId nestid)
          Add a new nest containing a document that match the specified keyword, represented by a hash of the keyword.
 boolean addKeyword(java.lang.String keyword, NestId nestid)
          Convert the query string in the corresponding hash value.
 void fillRoutingTable(Neighbour[] neighbours)
           
 java.lang.Object[] getCloseNests(KeyHash keyhash)
          Construct and return an array containing the neighbours nests for this node ordered by closeness of the value of the key (keyhash).
 boolean isEmpty()
          Check if the routing table is empty or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreenetAntPheromone

public FreenetAntPheromone()

FreenetAntPheromone

public FreenetAntPheromone(int capacity)
Method Detail

fillRoutingTable

public void fillRoutingTable(Neighbour[] neighbours)

addKeyword

public boolean addKeyword(java.lang.String keyword,
                          NestId nestid)
Convert the query string in the corresponding hash value. Then insert this value in the routing table.

addKeyhash

public boolean addKeyhash(KeyHash keyhash,
                          NestId nestid)
Add a new nest containing a document that match the specified keyword, represented by a hash of the keyword.

!!! Note that this method should perhaps be synchronized because there may be a race condition if trying to simultaneously add the same keyhash with different nestids.

Parameters:
keyhash - Hash of the keyword represented by a KeywordHash object.
nestid - Identifier for the nest holding a document represented by the specified keyword.
Returns:
true if the given keyword is already known. That is, other nests store information about this keyword. false is returned if the keyword is unknown.

getCloseNests

public java.lang.Object[] getCloseNests(KeyHash keyhash)
Construct and return an array containing the neighbours nests for this node ordered by closeness of the value of the key (keyhash).

isEmpty

public boolean isEmpty()
Check if the routing table is empty or not.