de.fhg.igd.jhsm
Interface Context

All Known Implementing Classes:
HSMAgent, HSMContext

public interface Context

A medium to publish and retrieve data to be shared between hsm components whose execution depends on some global memory state (e.g. actions or conditions). As in the interpreter design pattern the context contains information that are global to the interpreter.

Version:
"$Id: Context.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Haevecker
See Also:
Action, Interpreter

Method Summary
 Object get(String key)
          Returns the object that was associated with a given context key.
 EventBus getEventDispatcher()
          Returns the event dispatcher associated with the hsm to which the context belongs.
 Event getTriggerEvent()
          Returns the trigger event.
 void set(String key, Object value)
          Associates the specified value with the specified key in the context.
 void setEventDispatcher(EventBus dispatcher)
          Sets the event dispatcher associated with the hsm to which the context belongs.
 void setTriggerEvent(Event trigger)
          Sets the trigger event.
 

Method Detail

get

public Object get(String key)
Returns the object that was associated with a given context key.

Parameters:
key - The key whose associated value is to be returned.
Returns:
The requested object or null if the context contains no mapping for this key.

set

public void set(String key,
                Object value)
Associates the specified value with the specified key in the context. If the context previously contained a mapping for this key, the old value is replaced by the specified value.

Parameters:
key - The key with which the specified value is to be associated.
value - The value to be associated with the specified key.

getEventDispatcher

public EventBus getEventDispatcher()
Returns the event dispatcher associated with the hsm to which the context belongs.


setEventDispatcher

public void setEventDispatcher(EventBus dispatcher)
Sets the event dispatcher associated with the hsm to which the context belongs.


getTriggerEvent

public Event getTriggerEvent()
Returns the trigger event. Some actions are performed because a trigger event has been received. If an action is interested in the type of the event or it's parameters it can grab a reference to the event by using this method.

Returns:
The trigger event that was responsible for the execution of the action.

setTriggerEvent

public void setTriggerEvent(Event trigger)
Sets the trigger event. Some actions are performed because a trigger event has been received. This is used by the interpreter to update the action context.

Parameters:
trigger - The trigger event that was responsible for the execution of the action.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.