Java API for Tux Droid
com.tuxisalive.api.TuxEventHandler Class Reference
Collaboration diagram for com.tuxisalive.api.TuxEventHandler:

Public Member Functions

 TuxEventHandler ()
 
void destroy ()
 
List< Object > getLastState ()
 
void updateState (List< Object > state)
 
Integer register (Object sender, String method)
 
Integer register (Object sender, String method, Object... condition)
 
Integer register (Integer idx, Object sender, String method, Object... condition)
 
void unregister (Integer idx)
 
void storeContext ()
 
void restoreContext ()
 
void clearContext ()
 
void emit (Object... args)
 
void notify (Object... args)
 
Boolean waitCondition (Double timeout, Object... condition)
 
void clearPending ()
 

Private Member Functions

void setLastState (List< Object > value)
 
Integer pRegister (Object sender, String method, Object... condition)
 
Boolean pUpdateRegister (Integer idx, Object sender, String method, Object... condition)
 
void run (Hashtable< Object, Object > nFunct, Integer idx, List< Object > fArgs)
 
void lockListProcess (List< Object > fArgs)
 

Private Attributes

List< Object > functStructList
 
List< Object > fifoList
 
SLock listMutex
 
SLock lockMutex
 
List< Object > lockList
 
List< Object > lastState
 
SLock lastStateMutex
 

Detailed Description

TuxEventHandler is an event controller which give to you the mechanisms to make interactive an asynchronous signal.

Author
Remi Jocaille
Version
0.0.3

Constructor & Destructor Documentation

◆ TuxEventHandler()

com.tuxisalive.api.TuxEventHandler.TuxEventHandler ( )

Constructor of class.

Member Function Documentation

◆ clearContext()

void com.tuxisalive.api.TuxEventHandler.clearContext ( )

This method clear the configuration of the linked callbacks. In addition with the "storeContext" and "restoreContext" methods, you can manages the context of the event handler.

◆ clearPending()

void com.tuxisalive.api.TuxEventHandler.clearPending ( )

Clear all pending wait.

◆ destroy()

void com.tuxisalive.api.TuxEventHandler.destroy ( )

Destructor of class.

◆ emit()

void com.tuxisalive.api.TuxEventHandler.emit ( Object...  args)

Emit a signal on the event handler with a set of parameters.

Parameters
argsparameters.

◆ getLastState()

List<Object> com.tuxisalive.api.TuxEventHandler.getLastState ( )

Get the last knowed state of the event/status.

Returns
The last knowed state.

◆ lockListProcess()

void com.tuxisalive.api.TuxEventHandler.lockListProcess ( List< Object >  fArgs)
private

◆ notify()

void com.tuxisalive.api.TuxEventHandler.notify ( Object...  args)

Emit a signal on the event handler with a set of parameters.

Parameters
argsparameters.

◆ pRegister()

Integer com.tuxisalive.api.TuxEventHandler.pRegister ( Object  sender,
String  method,
Object...  condition 
)
private

◆ pUpdateRegister()

Boolean com.tuxisalive.api.TuxEventHandler.pUpdateRegister ( Integer  idx,
Object  sender,
String  method,
Object...  condition 
)
private

◆ register() [1/3]

Integer com.tuxisalive.api.TuxEventHandler.register ( Integer  idx,
Object  sender,
String  method,
Object...  condition 
)

Register another callback at the place of a previous index. The "condition" is the rule to match the callback event with a specific set of parameters when a signal is emitted. The number of objects from the condition need to be the same than the parameters of the emitted signal.

Parameters
idxthe index of the callback
senderparent object of the method.
methodmethod name as string.
conditionobject array of the condition.
Returns
the index of the callback in the handler.

◆ register() [2/3]

Integer com.tuxisalive.api.TuxEventHandler.register ( Object  sender,
String  method 
)

Register a callback function.

Parameters
senderparent object of the method.
methodmethod name as string.
Returns
the index of the callback in the handler.

◆ register() [3/3]

Integer com.tuxisalive.api.TuxEventHandler.register ( Object  sender,
String  method,
Object...  condition 
)

Register a callback function. The "condition" is the rule to match the callback event with a specific set of parameters when a signal is emitted. The number of objects from the condition need to be the same than the parameters of the emitted signal.

Parameters
senderparent object of the method.
methodmethod name as string.
conditionobject array of the condition.
Returns
the index of the callback in the handler.

◆ restoreContext()

void com.tuxisalive.api.TuxEventHandler.restoreContext ( )

This method restore from a stack the configuration of the linked callbacks. In addition with the "storeContext" and "clearContext" methods, you can manages the context of the event handler.

◆ run()

void com.tuxisalive.api.TuxEventHandler.run ( Hashtable< Object, Object >  nFunct,
Integer  idx,
List< Object >  fArgs 
)
private

◆ setLastState()

void com.tuxisalive.api.TuxEventHandler.setLastState ( List< Object >  value)
private

Set the state of the event.

Parameters
valueNew state.

◆ storeContext()

void com.tuxisalive.api.TuxEventHandler.storeContext ( )

This method store in a stack the configuration of the linked callbacks. In addition with the "restoreContext" and "clearContext" methods, you can manages the context of the event handler.

◆ unregister()

void com.tuxisalive.api.TuxEventHandler.unregister ( Integer  idx)

Unregister a callback from the event handler.

Parameters
idxindex of the callback.

◆ updateState()

void com.tuxisalive.api.TuxEventHandler.updateState ( List< Object >  state)

Update the state of the event without throwing callback.

Parameters
stateNew state.

◆ waitCondition()

Boolean com.tuxisalive.api.TuxEventHandler.waitCondition ( Double  timeout,
Object...  condition 
)

Synchronize a condition with a specific event.

Parameters
timeoutmaximal delay to wait.
conditionobject array of the condition.
Returns
the success of the waiting.

Member Data Documentation

◆ fifoList

List<Object> com.tuxisalive.api.TuxEventHandler.fifoList
private

◆ functStructList

List<Object> com.tuxisalive.api.TuxEventHandler.functStructList
private

◆ lastState

List<Object> com.tuxisalive.api.TuxEventHandler.lastState
private

◆ lastStateMutex

SLock com.tuxisalive.api.TuxEventHandler.lastStateMutex
private

◆ listMutex

SLock com.tuxisalive.api.TuxEventHandler.listMutex
private

◆ lockList

List<Object> com.tuxisalive.api.TuxEventHandler.lockList
private

◆ lockMutex

SLock com.tuxisalive.api.TuxEventHandler.lockMutex
private

The documentation for this class was generated from the following file: