elge.monitor
Class CoherenceMonitor

java.lang.Object
  |
  +--elge.monitor.AbstractMonitor
        |
        +--elge.monitor.CoherenceMonitor
All Implemented Interfaces:
EventListener, Monitor, PropertyChangeListener
Direct Known Subclasses:
GroupCoherenceMonitor

public class CoherenceMonitor
extends AbstractMonitor

This Monitor monitors and calculates the coherence of all WorldAgents that implements the LexikonHolder interface. It also calculates an global lexikon which you can get as a property.

Author:
Pavol Žibrita

Field Summary
 
Fields inherited from class elge.monitor.AbstractMonitor
per, PROP_PROJECT, pt
 
Constructor Summary
CoherenceMonitor()
          Creates a new instance of CoherenceMonitor
 
Method Summary
 Double calculateCoherence(Vector lexikons)
          Calculates the coherence from the world !
 String getDescription()
          Returns the description of this monitor, that should help to user to understand its function.
 String getFullName()
          Returns the full name which is displayed in gui lists.
 Lexikon getGlobalLexikon()
          gets the calculated global lexikon
 String[] getIdentifiers()
          Gets the identifiers.
 String getMonitorName()
          Returns only the name of the monitor (CoherenceMonitor)
 Object[] getValues()
          returns the calculated coherence or zero, if no coherence was calculated.
 void restart()
          restarts the monitor. nulls the global lexikon.
 void setGlobalLexikon(Lexikon glob)
          Sets the calculated lexikon.
protected  void updateMonitor()
          calls updateVectors()
 void updateVectors()
          Updates vectors needed for the calculations.
 
Methods inherited from class elge.monitor.AbstractMonitor
addPropertyChangeListener, getPersistence, getProject, propertyChange, removePropertyChangeListener, setPersistence, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoherenceMonitor

public CoherenceMonitor()
Creates a new instance of CoherenceMonitor

Method Detail

getIdentifiers

public String[] getIdentifiers()
Gets the identifiers. Currently the "coherence" string only.

Returns:
array of one value: coherence

getValues

public Object[] getValues()
returns the calculated coherence or zero, if no coherence was calculated.

Returns:
the coherence

calculateCoherence

public Double calculateCoherence(Vector lexikons)
Calculates the coherence from the world ! for each referent, calculate the coherence that means, the percentage of most sucessful word. so we create a new lexikon, where we store for each referent all words but only from prefered ones. For each use of word we increase the sucess use of it, and for each agent the use of it. the word most succesful and its ratio is the coherence for the referent. Global coherence is than calculated as avarage of all coherences..

Returns:
the coherence of all agents

updateVectors

public void updateVectors()
Updates vectors needed for the calculations. Is called from the updateMonitor() method.


getDescription

public String getDescription()
Returns the description of this monitor, that should help to user to understand its function.

Returns:
help for user.

getFullName

public String getFullName()
Returns the full name which is displayed in gui lists.

Returns:
full name.

getMonitorName

public String getMonitorName()
Returns only the name of the monitor (CoherenceMonitor)

Returns:
returns "CoherenceMonitor"

getGlobalLexikon

public Lexikon getGlobalLexikon()
gets the calculated global lexikon

Returns:
Lexikon

setGlobalLexikon

public void setGlobalLexikon(Lexikon glob)
Sets the calculated lexikon.

Parameters:
glob - The lexikon to set.

restart

public void restart()
restarts the monitor. nulls the global lexikon.

Specified by:
restart in interface Monitor
Overrides:
restart in class AbstractMonitor
See Also:
Project.restart()

updateMonitor

protected void updateMonitor()
calls updateVectors()

Overrides:
updateMonitor in class AbstractMonitor
See Also:
AbstractMonitor.propertyChange(java.beans.PropertyChangeEvent)