|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--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.
Constructor Summary | |
GnutantPheromone(AntView view)
Creates a new GnutantPheromone instance. |
|
GnutantPheromone(AntView view,
int capacity)
Creates a new GnutantPheromone instance. |
|
GnutantPheromone(AntView view,
int capacity,
int closeness)
Creates a new GnutantPheromone instance. |
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. |
java.util.ArrayList |
getNextNest(KeyHash keyhash,
java.util.ArrayList path)
Obtains a set of possible next nests based on the provided keyhash . |
java.lang.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 |
Constructor Detail |
public GnutantPheromone(AntView view)
GnutantPheromone
instance.view
- an AntView
valuepublic GnutantPheromone(AntView view, int capacity)
GnutantPheromone
instance.view
- an AntView
valuecapacity
- an int
valuepublic GnutantPheromone(AntView view, int capacity, int closeness)
GnutantPheromone
instance.view
- an AntView
valuecapacity
- an int
valuecloseness
- an int
valueMethod Detail |
public boolean addKeyhash(KeyHash 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
KeyHash
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 java.util.ArrayList getNextNest(KeyHash keyhash, java.util.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 java.lang.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 java.lang.Object
String
representation of the GnutantPheromone
object. A multiline string will be returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |