|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--jxtaimpl.AntView
This class is the enviroment where an Ant can operate.
| Constructor Summary | |
AntView(Nest nest,
AntDescriptor aDesc,
Factory factory)
Default constructor. |
|
| Method Summary | |
void |
addAnt(Ant ant)
Add a new ant to this nest. |
void |
addNeighbour(NestId id)
Ants invoke this method to add the identifier of a new neighbour nest to the set of neighbours known to the current nest. |
void |
addResource(Resource resource)
Add a resource to the nest. |
AntId |
createAntId()
Creates a new ant identifier. |
ResourceManager |
createResourceManager(String name)
Return a storage object identified by the given name. |
Ant |
getAnt()
Return the ant which is associated to this AntView. |
NestId |
getLastVisited()
Returns the identifier of the last nest visisted by this ant. |
Neighbour[] |
getNeighbours()
Ants invoke this method to obtain the list of nest neighbors known to the current nest. |
NestId |
getNestId()
Returns the identifier of the nest hosting the ant using this AntView. |
Resource |
getResource(Object query)
Performs the specified request on the local resource storage and returns the resources satisfying the request. |
ResourceManager |
getResourceManager(String name)
Return a storage object identified by the given name. |
Resource[] |
getResources(Object query)
Performs the specified request on the local resource storage and returns the resources satisfying the request. |
int |
getTTL()
Returns this ant's TTL value |
int |
intValue(String name)
Read the configuration parameter from its own Factory instance. |
void |
move(NestId id)
Method invoked by an ant in order to be sent to another Nest. |
void |
removeNeighbour(NestId id)
Ants invoke this method to remove a neighbor nest from the list of neighbors known to this nest. |
boolean |
returnResources(RequestId rid,
Resource[] resources)
This method is invoked by ants to notify the nest that the ant associated to this AntView, created to satisfy
a request, has found the specified set of resources. |
void |
updatePheromone(Object pheromone)
This method should be invoked by ants in order to update the current nest's pheromone instance every time they modify it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AntView(Nest nest,
AntDescriptor aDesc,
Factory factory)
Nest over which the
Ant wrapped in the AntDescriptor will operate
nest - The Nest this AntView belongs toaDesc - The AntDescriptor wrapping the Antfactory - The Factory instance used for reading in configuration
parameters| Method Detail |
public NestId getNestId()
AntView.
getNestId in interface AntViewpublic NestId getLastVisited()
getLastVisited in interface AntViewpublic int getTTL()
getTTL in interface AntViewpublic Ant getAnt()
AntView. Normally not
used by ants, as they may access the same information using
this.
getAnt in interface AntViewpublic AntId createAntId()
createAntId in interface AntViewpublic void addAnt(Ant ant)
addAnt in interface AntViewant - the ant to be added to the current nest
public void move(NestId id)
throws IOException
Nest. It is possible that particular
AntView implementation limit the operations
which can be performed after a move operation. For example,
movement to more than one nest (i.e., duplication) may not
be enabled.
move in interface AntViewid - the identifier of the destination nest
IOException - raised if the move operation fails,
for example due to the unreachability of the nest
public void addNeighbour(NestId id)
throws IOException
IOException
may be raised in the case a connection cannot be established.
addNeighbour in interface AntViewIOException - if a connection with the nest cannot be established.public void removeNeighbour(NestId id)
removeNeighbour in interface AntViewpublic Neighbour[] getNeighbours()
getNeighbours in interface AntViewpublic ResourceManager getResourceManager(String name)
getResourceManager in interface AntView
public ResourceManager createResourceManager(String name)
throws ResourceManagerException
createResourceManager in interface AntViewResourceManagerExceptionpublic void updatePheromone(Object pheromone)
public Resource[] getResources(Object query)
throws StorageNotFoundException
StorageNotFoundException
public Resource getResource(Object query)
throws StorageNotFoundException
StorageNotFoundException
public void addResource(Resource resource)
throws CapacityException,
StorageNotFoundException
Storage
associated with the invoking ant's species.
resource - resource to be added
CapacityException
StorageNotFoundException
public boolean returnResources(RequestId rid,
Resource[] resources)
AntView, created to satisfy
a request, has found the specified set of resources.
returnResources in interface AntViewresources - the resources satisfying the requestpublic int intValue(String name)
Factory instance.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||