|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--anthill.nestor.LocalAntView
Class LocalAntView is a simple implementation of interface
AntView
, which implements methods included in
it by invoking the opportune methods on the local nest.
Method Summary | |
void |
addAnt(Ant ant)
FIXME: Implement. |
void |
addNeighbour(NestId id)
Add the new neighbor information to the Gate object contained
in the current nest. |
void |
addResource(Resource resource)
Add the specified resource to the local nest. |
Ant |
getAnt()
Returns the ant which is associated to this AntView . |
AntId |
getAntId()
Returns the pseudo-unique identifier of the ant 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 . |
java.lang.Object |
getPheromone()
Get the pheromone information object related to the species of the ant associated to this AntView object. |
NestId |
getPreviousNest()
Lookup trail information on the Trail object stored
in the nest and move to the obtained nest. |
Resource[] |
getResources(java.lang.Object request)
Performs the specified request on the local nest and (possibly) returns the resources satisfying the request. |
void |
move(NestId id)
Moves an ant to the specified nest. |
void |
removeNeighbour(NestId id)
FIXME: Implement. |
void |
returnResources(Resource[] resources)
This method is invoked by ants to notify the nest that the ant associated to this AntView, created to satisfy a request, is returning the specified set of resources. |
void |
setPheromone(java.lang.Object pheromone)
Set the pheromone information object related to the species of the ant associated to this AntView object. |
boolean |
storePreviousNest()
Leave trail information on the Trail object stored
in the nest. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public NestId getNestId()
AntView
AntView
.getNestId
in interface AntView
public NestId getLastVisited()
AntView
getLastVisited
in interface AntView
public AntId getAntId()
AntView
AntView
.getAntId
in interface AntView
public Ant getAnt()
AntView
AntView
. Normally not
used by ants, as they may access the same information using
this
.getAnt
in interface AntView
public void addAnt(Ant ant)
The exact behavior of this method depends on the class implementing
the Manager
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
addAnt
in interface AntView
anthill.AntView
ant
- the ant to be added to the current nestpublic void move(NestId id) throws java.io.IOException
The exact behavior of this method depends on the class implementing
the Gate
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
move
in interface AntView
id
- the id of the destination nestjava.io.IOException
- if the ant cannot move to the
destination nest for communication problems.public boolean storePreviousNest()
Trail
object stored
in the nest. If absent, the trail is created. Return true if the
the information is left
The exact behavior of this method depends on the class implementing
the Trail
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
storePreviousNest
in interface AntView
anthill.AntView
true
if this is the first visit of this ant
to this nest (and thus, the information about the previous nest
has been stored successfully), or false
if this
ant has already visited the nest (and thus, the inforamtion about
the previous nest could not be stored).public NestId getPreviousNest()
Trail
object stored
in the nest and move to the obtained nest. If the trail is absent,
IllegalStateException
is raised.
The exact behavior of this method depends on the class implementing
the Trail
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
getPreviousNest
in interface AntView
anthill.AntView
IllegalStateException
- raised if no information about the previous
nest visited by this ant is present (for example, due to expiration).public void addNeighbour(NestId id) throws java.io.IOException
Gate
object contained
in the current nest. FIXME: correct implementation by removing addAntNeighbour
and adding the method to Gate.
The exact behavior of this method depends on the class implementing
the Gate
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
addNeighbour
in interface AntView
anthill.AntView
java.io.IOException
- if a connection with the nest cannot be established.public void removeNeighbour(NestId id)
The exact behavior of this method depends on the class implementing
the Gate
interface currently used in the current nest.
Please refer to the class documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
removeNeighbour
in interface AntView
public Neighbour[] getNeighbours()
The exact behavior of this method depends on the class implementing
the Gate
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
getNeighbours
in interface AntView
public java.lang.Object getPheromone()
AntView
object. Different
ant species are associated to different pheromone objects.
Please see the corresponding method comment in interface
AntView
for additional information.
getPheromone
in interface AntView
public void setPheromone(java.lang.Object pheromone)
AntView
object. Different
ant species are associated to different pheromone objects.setPheromone
in interface AntView
pheromone
- the pheromone object to be set.
Please see the corresponding method comment in interface
AntView
for additional information.
public Resource[] getResources(java.lang.Object request)
getResources
is invoked
on the Storage
object included in the nest.
The exact behavior of this method depends on the class implementing
the Storage
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
getResources
in interface AntView
request
- the request to be performedpublic void returnResources(Resource[] resources)
returnResources
in interface AntView
request
- the request to be performedresources
- the resources satisfying the querypublic void addResource(Resource resource)
addAntResource
is invoked
on the Storage
object included in the nest.
The exact behavior of this method depends on the class implementing
the Storage
interface currently used in the current nest.
Please refer to the implementation documentation for more details.
Please see the corresponding method comment in interface
AntView
for additional information.
addResource
in interface AntView
anthill.AntView
resource
- resource to be added
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |