kaos.vlik
Class ObserverService

java.lang.Object
  extended by kaos.vlik.ObserverService
All Implemented Interfaces:
KAoSObserver, AgentLifeListener, Service

public class ObserverService
extends java.lang.Object
implements KAoSObserver, Service, AgentLifeListener

Provides clients updates from observables.


Constructor Summary
ObserverService(ObservationTranslator translator, AgentLifeService lifeService)
           
 
Method Summary
 java.lang.String getID()
          Return the unique identifier of this observer.
 void update(java.lang.String observableID, java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
          Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.
 void whenAgentAppears(java.lang.String agentID)
           
 void whenAgentDisappears(java.lang.String agentID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObserverService

public ObserverService(ObservationTranslator translator,
                       AgentLifeService lifeService)
Parameters:
translator - An ObserverService relies on its translator to pass updates onto clients in a language they understand.
lifeService - An ObserverService relies on its lifeService to inform it of new agents and agents that have disappeared.
Method Detail

whenAgentAppears

public void whenAgentAppears(java.lang.String agentID)
Specified by:
whenAgentAppears in interface AgentLifeListener

whenAgentDisappears

public void whenAgentDisappears(java.lang.String agentID)
Specified by:
whenAgentDisappears in interface AgentLifeListener

update

public void update(java.lang.String observableID,
                   java.lang.String updateType,
                   java.lang.Object updateCondition,
                   java.lang.Object update)
Description copied from interface: KAoSObserver
Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.

Specified by:
update in interface KAoSObserver
Parameters:
observableID - String identifying the KAoSObservable sending the update.
updateType - String indicating type of update.
update - Object containing the update.

getID

public java.lang.String getID()
Description copied from interface: KAoSObserver
Return the unique identifier of this observer.

Specified by:
getID in interface KAoSObserver
Returns:
String containing the unique ID of this observer.