public interface EventConsumer
#processEvent(EventMsg)
method with the event.
Modifier and Type | Field and Description |
---|---|
static int |
mEventConsumed
Bit in return value of the
processEvent(EventObject)
for designation, that the given Event object was used to switch. |
static int |
mEventConsumerException
This bit is set if the consumption causes an exception which is not intended.
|
static int |
mEventConsumFinished
This is the bit that the event consumption is really finished, the work is done.
|
static int |
mEventDonotRelinquish
Bit in return value of the
processEvent(EventObject)
for designation, that the given Event object is stored in another queue, therefore it should not relinquished yet.. |
static int |
mMaskReservedHere
This is only a hint which bits are usable here for further usage.
|
static java.lang.String |
version
Version, history and license
2023-07-24 Hartmut remove: The 'awaitExecution(...)' is no longer member of.
|
Modifier and Type | Method and Description |
---|---|
EventThread_ifc |
evThread()
This operation should return that thread, which is associated to this consumer.
|
int |
processEvent(java.util.EventObject ev)
This routine should be overwritten from the user to processes an event.
|
static final java.lang.String version
EventConsumerAwait
, not general for all consumer, not used in vishia Software and not sense.
evThread()
#awaitExecution(long)
#shouldRun
which does not need to override in all implementation.
#getStateInfo()
any instance is able to quest for its state.
It may be an important method for debugging and showing.
toString(){ return "name"}
alternatively.
The method doProcessEvent is renamed to #processEvent(EventMsg)
.
The advantage of interface: multi inheritance.
It is used as interface for org.vishia.stateMachine.StateCompositeBase
.
static final int mEventConsumed
processEvent(EventObject)
for designation, that the given Event object was used to switch.static final int mEventDonotRelinquish
processEvent(EventObject)
for designation, that the given Event object is stored in another queue, therefore it should not relinquished yet..static final int mEventConsumFinished
mEventConsumed
: Last one is on each call of processEvent(EventObject)
,
If the process needs more events to transmit till if it is ready, then the last call should set this bit.
If the process is finished with one event processing, this bit should be set by the first return.static final int mEventConsumerException
static final int mMaskReservedHere
StateSimple.mRunToComplete
etc.EventThread_ifc evThread()
int processEvent(java.util.EventObject ev)
mEventConsumed
or StateSimple.mEventConsumed
: The event is designated as consumed.
If not set, the event should applied on other processEvent(EventObject)
operations,
for example for other states if possible
mEventDonotRelinquish
or StateSimple.mEventDonotRelinquish
: The event should not be relinquished
by the manager of the events (EventTimerThread), it will be relinquished later in the application after completion detection.
It means the application (user) declares itself responsible for relinquish. See EventWithDst.relinquish()
.
#mEventConsumerFinished
: The task which should be organized by the event is finished.
This bit is especially used to designate a TimeOrder
as finished for usage, quest in TimeOrder#awaitExecution(int, int)
.
Note that a task can need some more events or other conditions, this bit should be set on the last expected event
in the return value of processEvent(EventObject)
. For example if a copy of a file tree is finished,
or the graphic implementation is completely built.
mEventConsumerException
: The execution of processEvent(EventObject)
has thrown an error,
which is caught in the calling environment in EventTimerThread
.
How to deal with this information - the application is responsible to, the problem should be logged or debugged.
StateSimple
.
ev
- The event. It contains some data. The type of the event is not specified here. Any events
can be processed.mEventConsumed
or mEventDonotRelinquish
etc. see list above.
This value is forwarded to EventSource.notifyConsumed(int)
and can be evaluated by the application
in the calling thread or in any other thread which have access to implementation of EventSource
.