|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--antsim.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: comment. |
void |
addNeighbour(NestId id)
Add the new neighbor information to the Gate object contained
in 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)
Moves an ant to the specified nest. |
void |
removeNeighbour(NestId id)
FIXME: Implement. |
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, is returning the specified set of resources. |
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 int getTTL()
getTTL
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 AntId createAntId()
createAntId
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
ant
- the ant to be added to the current nestpublic void move(NestId id) throws 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 nest
IOException
- if the ant cannot move to the
destination nest for communication problems.public void addNeighbour(NestId id) throws 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
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 ResourceManager getResourceManager(String name)
getResourceManager
in interface AntView
public ResourceManager createResourceManager(String name) throws ResourceManagerException
createResourceManager
in interface AntView
ResourceManagerException
public boolean returnResources(RequestId rid, Resource[] resources)
returnResources
in interface AntView
resources
- the resources satisfying the query
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |