jxtaimpl
Class Trail

java.lang.Object
  |
  +--jxtaimpl.Trail
All Implemented Interfaces:
Clearable, ResourceManager, Trail

public class Trail
extends Object
implements Trail

This class is meant for storing associations such as (AntId, NestId) where the NestId identifies the nest this ant came from

Author:
Francesco Russo (frusso@cs.unibo.it)

Field Summary
 
Fields inherited from interface anthill.storage.Trail
NAME
 
Constructor Summary
Trail()
          Default constructor
 
Method Summary
 boolean add(AntId antId, NestId srcNest)
          Add a new entry.
 void clear()
          Bring the initial state of this object back
 NestId lookup(AntId antId, boolean remove)
          Look for the NestId associated with the provided AntId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Trail

public Trail()
Default constructor

Method Detail

add

public boolean add(AntId antId,
                   NestId srcNest)
Add a new entry. This new entry's key is the AntId This method will return TRUE iff that's the first time the ant identified by antId is storing information in this Trail instance

Specified by:
add in interface Trail

lookup

public NestId lookup(AntId antId,
                     boolean remove)
Look for the NestId associated with the provided AntId. The entry itself is going to be removed just in case the "remove" argument is true. If nothing is found, null will be returned

Specified by:
lookup in interface Trail
Parameters:
antId - the identifier of the ant
remove - true if the association (ant id, nest id) should be removed after retrieval

clear

public void clear()
Bring the initial state of this object back

Specified by:
clear in interface Clearable