|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface AntView
contains the set of methods which are
accessible to ants when visiting nests. These methods enable ants to
cooperate with nests in a controlled way. For example, ants may
retrieve resources from or add resources to a nest; obtain routing
information related to other nests; move to other nests, and so on.
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. |
AntId |
createAntId()
Creates a new ant identifier. |
ResourceManager |
createResourceManager(String name)
Returns a reference to the resource manager identified by the given name, if present. |
Ant |
getAnt()
Returns 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 current nest hosting the ant using this AntView . |
ResourceManager |
getResourceManager(String name)
Returns a reference to the resource manager identified by the given name. |
int |
getTTL()
|
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. |
Method Detail |
public NestId getNestId()
AntView
.
public NestId getLastVisited()
public int getTTL()
public Ant getAnt()
AntView
. Normally not
used by ants, as they may access the same information using
this
.
public AntId createAntId()
public void addAnt(Ant ant)
The exact behavior of this method depends on the implementation of the current nest hosting the ant. Please refer to the documentation of the nest implementation for more details.
ant
- the ant to be added to the current nestpublic 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.
The exact behavior of this method depends on the implementation of the current nest hosting the ant. Please refer to the documentation of the nest implementation for more details.
id
- the identifier of the destination nest
IOException
- raised if the move operation fails,
for example due to the unreachability of the nestpublic void addNeighbour(NestId id) throws IOException
IOException
may be raised in the case a connection cannot be established.
The exact behavior of this method depends on the implementation of the current nest hosting the ant. Please refer to the documentation of the nest implementation for more details.
IOException
- if a connection with the nest cannot be established.public void removeNeighbour(NestId id)
The exact behavior of this method depends on the implementation of the current nest hosting the ant. Please refer to the documentation of the nest implementation for more details.
public Neighbour[] getNeighbours()
The exact behavior of this method depends on the implementation of the current nest hosting the ant. Please refer to the documentation of the nest implementation for more details.
public ResourceManager getResourceManager(String name)
public ResourceManager createResourceManager(String name) throws ResourceManagerException
name
as
lookup identifier in the factory object to obtain the current configuration.
ResourceManager
- this exception is thrown if, for some reason,
it is impossible to create a resource manager
ResourceManagerException
public boolean returnResources(RequestId rid, Resource[] resources)
AntView
, created to satisfy
a request, has found the specified set of resources.
resources
- the resources satisfying the request
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |