|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ants.gnutant.GnutantPheromone
Gnutant Pheromone is "the routing table" of the Gnutant species. Ants may only add knowledge about new keywords, and the nest where documents relating to that keyword may be found. The underlying data structure will take care of limiting the resource (memory) usage, by implementing an LRU policy. Ants may also obtain a list of nests that contain more information about a given keyword or closely matching keywords.
Field Summary | |
static String |
NAME
Identifier used in the configuration files |
static String |
PAR_CAPACITY
String name of the parameter used to determine the number of repetitions to be executed. |
static String |
PAR_CLOSENESS
String name of the parameter used to determine the number of iterations to be executed. |
Constructor Summary | |
GnutantPheromone(Factory factory,
String name)
Creates a new GnutantPheromone instance. |
Method Summary | |
boolean |
addKeyhash(HashedKeyword keyhash,
NestId nestid)
Add a new nest containing a document that match the specified keyword, represented by a hash of the keyword. |
ArrayList |
getNextNest(HashedKeyword keyhash,
ArrayList path)
Obtains a set of possible next nests based on the provided keyhash . |
String |
toString()
Returns a string representation of the GnutantPheromone .
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String NAME
public static final String PAR_CAPACITY
public static final String PAR_CLOSENESS
Constructor Detail |
public GnutantPheromone(Factory factory, String name)
GnutantPheromone
instance. The object is
created through the factory; possible initialization is performed
through init
methods.
factory
- the factory to be used to read configuration arguments
and to create other configurable objectsname
- the name that is associated to this instance in the
configuration fileMethod Detail |
public boolean addKeyhash(HashedKeyword keyhash, NestId nestid)
Note that this method is synchronized because there may be a race condition if trying to simultaneously add the same keyhash with different nest identifiers.
keyhash
- Hash of the keyword represented by a
HashedKeyword
object.nestid
- Identifier for the nest holding a document
represented by the specified keyword.
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.public ArrayList getNextNest(HashedKeyword keyhash, ArrayList path)
keyhash
. If there is no exact match for the
specified keyhash in the underlying datastructure the closes
match will be made available in the first position in the
returned ArrayList.
keyhash
- the keyword to match against to find the set
of possible next nests.path
- a list of nests to avoid, since we have already
visited them.
public String toString()
GnutantPheromone
.
Since this a sort routing table, it will typically be large, so using
this for outputing to the screen is ill-advised. It is mainly useful
for logging the content of the pheromone tables at various times during
a run.
toString
in class Object
String
representation of the GnutantPheromone
object. A multiline string will be returned.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |