elge.monitor
Class AbstractMonitor

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

public abstract class AbstractMonitor
extends Object
implements Monitor, PropertyChangeListener

This class is a basic class for derivating new monitors.

It defines some common thing, that you don;t need to make again and again.

Author:
Pavol Žibrita

Field Summary
protected  boolean per
          the persistence of monitor is defaut set to true.
static String PROP_PROJECT
          The project property identifier.
protected  Project pt
          The project the monitor is in.
 
Constructor Summary
AbstractMonitor()
          The class is abstract, but the constructor adds this object as listener to itself :).
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Add listner
 boolean getPersistence()
          True, if the monitor is writing the data to the disk...
 Project getProject()
          Gets the project
 void propertyChange(PropertyChangeEvent evt)
          This method gets called when a bound property is changed.
 void removePropertyChangeListener(PropertyChangeListener l)
          remove listener
 void restart()
          Restarts the monitor.
 void setPersistence(boolean per)
          See getPersistence()
 void setProject(Project pt)
          Sets the Project the monitor is in.
protected  void updateMonitor()
          Empty method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface elge.engine.Monitor
getDescription, getFullName, getIdentifiers, getMonitorName, getValues
 

Field Detail

PROP_PROJECT

public static final String PROP_PROJECT
The project property identifier.

See Also:
Constant Field Values

per

protected boolean per
the persistence of monitor is defaut set to true.


pt

protected Project pt
The project the monitor is in.

Constructor Detail

AbstractMonitor

public AbstractMonitor()
The class is abstract, but the constructor adds this object as listener to itself :).

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Add listner

Parameters:
l - the listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
remove listener

Parameters:
l - the lsitener

getProject

public Project getProject()
Gets the project

Specified by:
getProject in interface Monitor
Returns:
The Project the monitor is in.

setProject

public void setProject(Project pt)
Sets the Project the monitor is in.

Specified by:
setProject in interface Monitor
Parameters:
pt - The actual Project

getPersistence

public boolean getPersistence()
True, if the monitor is writing the data to the disk...

Specified by:
getPersistence in interface Monitor
Returns:
true if you want to save data from this monitor

setPersistence

public void setPersistence(boolean per)
See getPersistence()

Specified by:
setPersistence in interface Monitor
Parameters:
per - the value
See Also:
Monitor.getPersistence()

restart

public void restart()
Restarts the monitor. MOnitor whould clear what every is needed for a new simulation.

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

updateMonitor

protected void updateMonitor()
Empty method.

See Also:
propertyChange(java.beans.PropertyChangeEvent)

propertyChange

public void propertyChange(PropertyChangeEvent evt)
This method gets called when a bound property is changed.

The montor hooks up on self and on the project and world. If the World Representation property changes, or Project Word property or MOnitor Project property, this method calls updateMonitor() method.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - A PropertyChangeEvent object describing the event source and the property that has changed.