gr.demokritos.iit.jinsect.distributed
Class NGramDocumentComparatorAgent

java.lang.Object
  extended by jade.core.Agent
      extended by gr.demokritos.iit.jinsect.distributed.MobileAgent
          extended by gr.demokritos.iit.jinsect.distributed.NGramDocumentComparatorAgent
All Implemented Interfaces:
jade.core.TimerListener, java.io.Serializable, java.lang.Runnable

public class NGramDocumentComparatorAgent
extends MobileAgent

A mobile agent that manages the comparison between two documents. It has the ability to migrate and inform its dispatcher of its arrival. Then it performs any calculation it receives via agent messages.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jade.core.Agent
jade.core.Agent.Interrupted
 
Field Summary
static int ACTIVE_STATE
           
static int CALC_STATE
           
static int FINISHED_STATE
           
static int INVALID_STATE
           
static int MIGRATE_STATE
           
protected  double MigrationProbability
           
protected  jade.core.AID ResultConsumer
           
protected  java.lang.String sDocument1
           
protected  java.lang.String sDocument2
           
static java.lang.String TERMINATION_MESSAGE
           
 
Fields inherited from class gr.demokritos.iit.jinsect.distributed.MobileAgent
CLONE_EVENT, CONTINUE_EVENT, EXIT, Locations, MOVE_EVENT, REFRESH_EVENT, STOP_EVENT
 
Fields inherited from class jade.core.Agent
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN
 
Constructor Summary
NGramDocumentComparatorAgent()
          Creates a new instance of NGramDocumentComparatorAgent
 
Method Summary
protected  void afterMove()
          Updates dispatcher upon arrival to target container.
protected  void beforeMove()
          Displays debug info before migration.
 jade.core.Location[] getActiveContainerList()
          Returns an array of active locations.
 void setResult(SimilarityArray saResult, java.lang.String sID)
          Prepares and sends a calculated result.
 void setup()
          Parses arguments and initializes migration.
 void takeDown()
          Offers debug info for the termination of the agent.
 void updateLocations(java.util.Iterator iIter)
          Updates the location list and schedules migrations.
 
Methods inherited from class gr.demokritos.iit.jinsect.distributed.MobileAgent
afterLoad, afterReload, afterThaw, beforeFreeze, beforeReload
 
Methods inherited from class jade.core.Agent
addBehaviour, afterClone, beforeClone, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAMS, getArguments, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getHap, getHelper, getLocalName, getName, getO2AObject, getProperty, getQueueSize, getState, here, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, removeBehaviour, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setQueueSize, waitUntilStarted, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_STATE

public static final int INVALID_STATE
See Also:
Constant Field Values

ACTIVE_STATE

public static final int ACTIVE_STATE
See Also:
Constant Field Values

MIGRATE_STATE

public static final int MIGRATE_STATE
See Also:
Constant Field Values

CALC_STATE

public static final int CALC_STATE
See Also:
Constant Field Values

FINISHED_STATE

public static final int FINISHED_STATE
See Also:
Constant Field Values

TERMINATION_MESSAGE

public static final java.lang.String TERMINATION_MESSAGE
See Also:
Constant Field Values

ResultConsumer

protected jade.core.AID ResultConsumer

sDocument1

protected java.lang.String sDocument1

sDocument2

protected java.lang.String sDocument2

MigrationProbability

protected double MigrationProbability
Constructor Detail

NGramDocumentComparatorAgent

public NGramDocumentComparatorAgent()
Creates a new instance of NGramDocumentComparatorAgent

Method Detail

setResult

public void setResult(SimilarityArray saResult,
                      java.lang.String sID)
Prepares and sends a calculated result.

Parameters:
saResult - The similarity array to return.
sID - The unique comparison identifier.

setup

public void setup()
Parses arguments and initializes migration.

Overrides:
setup in class MobileAgent

beforeMove

protected void beforeMove()
Displays debug info before migration.

Overrides:
beforeMove in class MobileAgent

afterMove

protected void afterMove()
Updates dispatcher upon arrival to target container.

Overrides:
afterMove in class MobileAgent

takeDown

public void takeDown()
Offers debug info for the termination of the agent.

Overrides:
takeDown in class jade.core.Agent

getActiveContainerList

public jade.core.Location[] getActiveContainerList()
Returns an array of active locations.

Returns:
The array of locations.

updateLocations

public void updateLocations(java.util.Iterator iIter)
Updates the location list and schedules migrations.

Overrides:
updateLocations in class MobileAgent
Parameters:
iIter - An iterator of candidate locations.