Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hammurapi.eventbus
Class PredicateChainingMatcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

Show UML class diagram

    java.lang.Object
      com.hammurapi.eventbus.PredicateChainingMatcher<E,P,C,K,H,S>

All Implemented Interfaces:
  Matcher<E,P,C,K,H,S>

Direct Known Subclasses:
  LocalPredicateChainingMatcher

    public abstract class PredicateChainingMatcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

extends Object
implements Matcher<E,P,C,K,H,S>

Nested Class Summary
`protected class` | `PredicateChainingMatcher.EventBusJoiner`
`protected class` | `PredicateChainingMatcher.JoinInput`
`protected class` | `PredicateChainingMatcher.JoinInputEventHandler`
`protected class` | `PredicateChainingMatcher.JoinNode` Joins several inputs, applies predicate(s)

Nested classes/interfaces inherited from interface com.hammurapi.eventbus.Matcher
`Matcher.HandlerManager<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`

Field Summary
`protected PredicatedInferenceNode<E,P,C,K,H,S>` | `rootNode` Root inference node with True predicate.

Constructor Summary
`PredicateChainingMatcher()`

Method Summary
`K` | `addHandler(EventHandler<E,P,C,H,S> eventHandler)` Adds handler to the matcher.
`protected abstract TrackingExecutorService` | `createExecutorService(ExecutorService master, boolean oneOff, String name)` Creates a wrapper around the master executor service for task tracking purposes.
`protected abstract PredicateChainingMatcher.EventBusJoiner` | `createJoiner(JoinEventHandler<E,P,C,K,H,S> handler, int[][] indices)`
`protected abstract PredicatedInferenceNode<E,P,C,K,H,S>` | `createPredicatedInferenceNode(PredicatedInferenceNode<E,P,C,K,H,S> parent, predicate, C context)`
`protected abstract Set<K>` | `extractHandlerIds(EventHandlerWrapper<E,P,C,K,H,S> handler)`
`EventBus<E,P,C,K,H,S>` | `getEventBus()`
`protected abstract ReadWriteLock` | `getLock()` Lock for the inference network.
`void` | `manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)` This method is used for batch live updates of matcher handlers.
`Iterable<EventHandlerWrapper<E,P,C,K,H,S>>` | `match(E event, ExecutorService executorService)`
`protected abstract K` | `nextId()` Generates handler ID.
`void` | `removeHandlers(Iterable<K> keys)`
`void` | `reset()` Resets handler's state.
`void` | `setEventBus(EventBus<E,P,C,K,H,S> bus)` This method is invoked by the bus to provide a reference to self.
`void` | `takeSnapshot(AbstractEventBus.Snapshot<E,P,C,K,H,S> snapshot)` Takes matcher snapshot.
`protected abstract EventHandlerWrapper<E,P,C,K,H,S>` | `wrap(EventHandler<E,P,C,H,S> eventHandler, K registrationKey)` Factory method for handler wrapper.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### rootNode

    protected PredicatedInferenceNode<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>> rootNode

  Root inference node with True predicate. Shall be initialized by subclass.

Constructor Detail

### PredicateChainingMatcher

    public PredicateChainingMatcher()

Method Detail

### createExecutorService

    protected abstract TrackingExecutorService createExecutorService(ExecutorService master,
                                                                     boolean oneOff,
                                                                     String name)

  Creates a wrapper around the master executor service for task tracking purposes.

  Parameters:
    `master` - Master executor service
  Returns:

### match

    public Iterable<EventHandlerWrapper<E,P,C,K,H,S>> match(E event,
                                                            ExecutorService executorService)

  Specified by:
    `match` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`
    `executorService` - Executor service to use for parallel matching.
  Returns:
    Handlers matching the event ordered by priority.

### addHandler

    public K addHandler(EventHandler<E,P,C,H,S> eventHandler)

  Description copied from interface: `Matcher`
  Adds handler to the matcher.

  Specified by:
    `addHandler` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`
  Returns:

### getLock

    protected abstract ReadWriteLock getLock()

  Lock for the inference network.

  Returns:

### takeSnapshot

    public void takeSnapshot(AbstractEventBus.Snapshot<E,P,C,K,H,S> snapshot)

  Description copied from interface: `Matcher`
  Takes matcher snapshot.

  Specified by:
    `takeSnapshot` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`

### removeHandlers

    public void removeHandlers(Iterable<K> keys)

  Specified by:
    `removeHandlers` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`

### reset

    public void reset()

  Description copied from interface: `Matcher`
  Resets handler's state.

  Specified by:
    `reset` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`

### manageHandlers

    public void manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)

  Description copied from interface: `Matcher`
  This method is used for batch live updates of matcher handlers. The method acquires matcher write lock, then invokes matcher manager's manageHandlers() method within the lock and then releases the lock. Therefore, matcher structure update is executed as one logical unit.

  Specified by:
    `manageHandlers` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`

### createPredicatedInferenceNode

    protected abstract PredicatedInferenceNode<E,P,C,K,H,S> createPredicatedInferenceNode(PredicatedInferenceNode<E,P,C,K,H,S> parent,
                                                                                           predicate,
                                                                                          C context)

### extractHandlerIds

    protected abstract Set<K> extractHandlerIds(EventHandlerWrapper<E,P,C,K,H,S> handler)

### nextId

    protected abstract K nextId()

  Generates handler ID.

  Returns:

### wrap

    protected abstract EventHandlerWrapper<E,P,C,K,H,S> wrap(EventHandler<E,P,C,H,S> eventHandler,
                                                             K registrationKey)

  Factory method for handler wrapper.

  Parameters:
    `eventHandler` -
    `oneOff` -
  Returns:

### createJoiner

    protected abstract PredicateChainingMatcher.EventBusJoiner createJoiner(JoinEventHandler<E,P,C,K,H,S> handler,
                                                                            int[][] indices)

### setEventBus

    public void setEventBus(EventBus<E,P,C,K,H,S> bus)

  Description copied from interface: `Matcher`
  This method is invoked by the bus to provide a reference to self.

  Specified by:
    `setEventBus` in interface `Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>`

### getEventBus

    public EventBus<E,P,C,K,H,S> getEventBus()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD