com.hammurapi.eventbus
Class PredicateChainingMatcher.JoinInputEventHandler

Show UML class diagram
java.lang.Object
  extended by com.hammurapi.eventbus.PredicateChainingMatcher.JoinInputEventHandler
All Implemented Interfaces:
EventHandlerBase<E,P,C>, EventHandlerWrapper<E,P,C,K,H,S>
Enclosing class:
PredicateChainingMatcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

protected class PredicateChainingMatcher.JoinInputEventHandler
extends Object
implements EventHandlerWrapper<E,P,C,K,H,S>


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.hammurapi.eventbus.EventHandlerBase
EventHandlerBase.Mode
 
Method Summary
 boolean consumes()
           
 int getCardinality()
           
 C getContext()
           
 EventHandler<E,P,C,H,S> getHandler()
           
 K getId()
           
 EventHandlerBase.Mode getMode()
          Handler mode.
  getPredicate()
          Predicate which was used during registration.
 P getPriority()
           
 Set<K> getRegistrationKeys()
           
 boolean isOneOff()
          If this method returns true, then handler is invoked only once and then is removed from the bus.
 void post(EventDispatchContext<E,P,C,H,S> context, InferenceContext<E,P,C,K,H,S> inferenceContext, AbstractEventBus.Handle<E,P,C,K>... handles)
          Posts event for handling.
 void reset()
          Resets handler internal state, if any.
 void takeSnapshot(AbstractEventBus.Snapshot<E,P,C,K,H,S> snapshot, Set<K> taken)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getId

public K getId()

consumes

public boolean consumes()
Specified by:
consumes in interface EventHandlerBase<E,P extends Comparable<P>,C>
Returns:
true if this handler consumes or updates events.

getCardinality

public int getCardinality()
Specified by:
getCardinality in interface EventHandlerBase<E,P extends Comparable<P>,C>
Returns:
Number of parameters expected by this handler.

getContext

public C getContext()
Specified by:
getContext in interface EventHandlerBase<E,P extends Comparable<P>,C>
Returns:
Context for predicates.

getPriority

public P getPriority()
Specified by:
getPriority in interface EventHandlerBase<E,P extends Comparable<P>,C>
Returns:
priority Handler priority. Handlers with higher priority are guaranteed to be executed before handlers with lower priority and as such can consume events and prevent their dispatching to other handlers.

post

public void post(EventDispatchContext<E,P,C,H,S> context,
                 InferenceContext<E,P,C,K,H,S> inferenceContext,
                 AbstractEventBus.Handle<E,P,C,K>... handles)
Description copied from interface: EventHandlerWrapper
Posts event for handling.

Specified by:
post in interface EventHandlerWrapper<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>
Parameters:
context - Event dispatching context.
handles - Events to handle. An event to handle if there is one event. A tuple of joined events to handle otherwise.

reset

public void reset()
Description copied from interface: EventHandlerBase
Resets handler internal state, if any.

Specified by:
reset in interface EventHandlerBase<E,P extends Comparable<P>,C>

getHandler

public EventHandler<E,P,C,H,S> getHandler()
Specified by:
getHandler in interface EventHandlerWrapper<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

getRegistrationKeys

public Set<K> getRegistrationKeys()
Specified by:
getRegistrationKeys in interface EventHandlerWrapper<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>
Returns:
set of registration keys. Shared join event handler can have more than one registration key. When the set becomes empty the handler shall be removed from the inference network. Join event handlers shall cascade remove(K) to target handlers.

takeSnapshot

public void takeSnapshot(AbstractEventBus.Snapshot<E,P,C,K,H,S> snapshot,
                         Set<K> taken)
Specified by:
takeSnapshot in interface EventHandlerWrapper<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

getPredicate

public  getPredicate()
Description copied from interface: EventHandlerWrapper
Predicate which was used during registration.

Specified by:
getPredicate in interface EventHandlerBase<E,P extends Comparable<P>,C>
Specified by:
getPredicate in interface EventHandlerWrapper<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>
Returns:
Handler predicates.

toString

public String toString()
Overrides:
toString in class Object

isOneOff

public boolean isOneOff()
Description copied from interface: EventHandlerBase
If this method returns true, then handler is invoked only once and then is removed from the bus.

Specified by:
isOneOff in interface EventHandlerBase<E,P extends Comparable<P>,C>
Returns:

getMode

public EventHandlerBase.Mode getMode()
Description copied from interface: EventHandlerBase
Handler mode.

Specified by:
getMode in interface EventHandlerBase<E,P extends Comparable<P>,C>
Returns: