ants.gnutant
Class Insant

java.lang.Object
  |
  +--ants.gnutant.Insant
All Implemented Interfaces:
Ant, Externalizable, Serializable

public class Insant
extends Object
implements Ant, Externalizable

Ant implementation for inserting a document into the anthill network. An insertion involves a user make a document available in her upload repository and sending out a number of ants to make the anthill network aware of the document. The user must supply a couple of keywords that describes the document, and this will generate one ant for each supplied keyword. Each of these ants are routed along a single trail, leaving information about the document at each nest along the trail. Routing will follow the lexicographical closeness of the keywords. The Insant is of the Gnutant species.

Version:
$Revision: 1.5 $
Author:
Hein Meling
See Also:
Serialized Form

Constructor Summary
Insant()
          Default constructor for externalization.
Insant(HashedKeyword keyhash, UrlResource url)
          Instantiate a new Gnutant by setting the query to be satisfied and the hash value to be searched.
 
Method Summary
 String getSpecies()
          Returns the identifier of the "species" of this ant.
 void init(AntView view)
          Initialize the InsertGnutant at the originating nest.
 void readExternal(ObjectInput in)
          Describe readExternal method here.
 void run(AntView view)
          This method encapsulate the computation performed by the ant.
 void writeExternal(ObjectOutput out)
          Describe writeExternal method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Insant

public Insant()
Default constructor for externalization.


Insant

public Insant(HashedKeyword keyhash,
              UrlResource url)
Instantiate a new Gnutant by setting the query to be satisfied and the hash value to be searched.

Method Detail

getSpecies

public String getSpecies()
Description copied from interface: Ant
Returns the identifier of the "species" of this ant. Different ant species may have access to different pheromone information in nests.

Specified by:
getSpecies in interface Ant

init

public void init(AntView view)
Initialize the InsertGnutant at the originating nest.

Specified by:
init in interface Ant
Parameters:
view - an AntView value

run

public void run(AntView view)
This method encapsulate the computation performed by the ant. This ant implementation will route itself along a path with identical or similar (closeness) hashed keywords. At each nest along this path, it will insert a URL reference to the document uploaded at the originating nest.

Specified by:
run in interface Ant
Parameters:
view - reference to the AntView object which constitutes the controlled environment of the ant

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Describe readExternal method here.

Specified by:
readExternal in interface Externalizable
Parameters:
in - an ObjectInput value
Throws:
IOException - if an error occurs
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Describe writeExternal method here.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - an ObjectOutput value
Throws:
IOException - if an error occurs