|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--anthill.storage.impl.LocalTrail
Class LocalTrail
is the implementation of Trail
to be used during off-line simulations. Programmers are enabled to specify
the maximum number of associations (ant identifier, previous nest identifier)
which can be stored in a LocalTrail
object, or the maximum duration
of such an associations in a LocalTrail
object, or both.
Assocations which exceed the maximum capacity or are older than the maximum
duration are discarded from this LocalTrail
.
Field Summary | |
static String |
PAR_MAXSIZE
The identifier of the configuration parameter containing the maximum number of pairs (ant id, nest id) that may be stored in a Trail object. |
static String |
PAR_MAXTIME
The identifier of the configuration parameter containing the maximum time of permanence of a pair (ant id, nest id) in a Trail object. |
Fields inherited from interface anthill.storage.Trail |
NAME |
Constructor Summary | |
LocalTrail(Factory factory,
String name)
Instantiate a new empty Trail object. |
Method Summary | |
boolean |
add(AntId id,
NestId source)
Add a pair (id, source) to the trail object containing the host. |
void |
clear()
Restores the object to its initial state. |
NestId |
lookup(AntId id,
boolean remove)
Lookup this LocalTrail object in order to obtain the
identifier of the nest from which the specified
ant arrived. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String PAR_MAXSIZE
Trail
object.
public static final String PAR_MAXTIME
Trail
object.
Constructor Detail |
public LocalTrail(Factory factory, String name)
Trail
object. The maximum number of
pairs (ant id, source) that may be contained in it, and the maximum duration
of pairs are read through the factory object.
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 void clear()
clear
in interface Clearable
public boolean add(AntId id, NestId source)
add
in interface Trail
public NestId lookup(AntId id, boolean remove)
LocalTrail
object in order to obtain the
identifier of the nest from which the specified
ant arrived. The pair associating the ant
identifier to the source nest is removed from
both the hash table and the linked list.
lookup
in interface Trail
id
- the identifier of the antremove
- true if the association (ant id, nest id)
should be removed after retrievalpublic String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |