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 PredicatedInferenceNode<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.PredicatedInferenceNode<E,P,C,K,H,S>

Type Parameters:
  `E` -
  `P` -
  `C` -

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

extends Object

Field Summary
`protected PredicateChainingMatcher<E,P,C,K,H,S>` | `matcher`

Constructor Summary
`PredicatedInferenceNode(PredicatedInferenceNode<E,P,C,K,H,S> parent, PredicateChainingMatcher<E,P,C,K,H,S> matcher, predicate, C context, K id)`

Method Summary
`void` | `collectHandlers(Map<C,Map<,? super Boolean>> cache, Collection<EventHandlerWrapper<E,P,C,K,H,S>> collector, E event)` Collects handlers synchronously.
`void` | `collectHandlers(Map<C,Map<,? super Boolean>> cache, ExecutorService executor, AtomicReference<Collection<Future<Collection<EventHandlerWrapper<E,P,C,K,H,S>>>>> collector, E event)` Collects handlers asynchronously.
`protected abstract Callable<Collection<EventHandlerWrapper<E,P,C,K,H,S>>>` | `createCollectorTask(Map<C,Map<,? super Boolean>> cache, ExecutorService executor, AtomicReference<Collection<Future<Collection<EventHandlerWrapper<E,P,C,K,H,S>>>>> collector, E event)`
`Collection<EventHandlerWrapper<E,P,C,K,H,S>>` | `getAllHandlers()` This method is used when this node is moved under another node.
`C` | `getContext()`
`protected abstract List<PredicatedInferenceNode<E,P,C,K,H,S>>` | `getFalseChildren()`
`protected abstract List<EventHandlerWrapper<E,P,C,K,H,S>>` | `getFalseHandlers()`
`K` | `getId()`
`protected PredicateChainingMatcher<E,P,C,K,H,S>` | `getMatcher()`
`` | `getPredicate()`
`protected abstract List<PredicatedInferenceNode<E,P,C,K,H,S>>` | `getTrueChildren()`
`protected abstract List<EventHandlerWrapper<E,P,C,K,H,S>>` | `getTrueHandlers()`
`boolean` | `isRoot()`
`void` | `rebuild()` Rebuilds inference network.
`boolean` | `remove(List<PredicatedInferenceNode<E,P,C,K,H,S>> parentTrueChildren, List<PredicatedInferenceNode<E,P,C,K,H,S>> parentFalseChildren, boolean isTrueChild, Iterable<K> keys)` Removes handler(s) specified by the key(s).
`void` | `reset()` Resets state of the node and its children.
`void` | `setRoot(boolean isRoot)`

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

Field Detail

### matcher

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

Constructor Detail

### PredicatedInferenceNode

    public PredicatedInferenceNode(PredicatedInferenceNode<E,P,C,K,H,S> parent,
                                   PredicateChainingMatcher<E,P,C,K,H,S> matcher,
                                    predicate,
                                   C context,
                                   K id)

Method Detail

### getFalseChildren

    protected abstract List<PredicatedInferenceNode<E,P,C,K,H,S>> getFalseChildren()

### getTrueChildren

    protected abstract List<PredicatedInferenceNode<E,P,C,K,H,S>> getTrueChildren()

### getFalseHandlers

    protected abstract List<EventHandlerWrapper<E,P,C,K,H,S>> getFalseHandlers()

### getTrueHandlers

    protected abstract List<EventHandlerWrapper<E,P,C,K,H,S>> getTrueHandlers()

### getMatcher

    protected PredicateChainingMatcher<E,P,C,K,H,S> getMatcher()

### createCollectorTask

    protected abstract Callable<Collection<EventHandlerWrapper<E,P,C,K,H,S>>> createCollectorTask(Map<C,Map<,? super Boolean>> cache,
                                                                                                  ExecutorService executor,
                                                                                                  AtomicReference<Collection<Future<Collection<EventHandlerWrapper<E,P,C,K,H,S>>>>> collector,
                                                                                                  E event)

### setRoot

    public void setRoot(boolean isRoot)

### isRoot

    public boolean isRoot()

### getId

    public K getId()

### getPredicate

    public  getPredicate()

### getContext

    public C getContext()

### rebuild

    public void rebuild()

  Rebuilds inference network.

### collectHandlers

    public void collectHandlers(Map<C,Map<,? super Boolean>> cache,
                                Collection<EventHandlerWrapper<E,P,C,K,H,S>> collector,
                                E event)

  Collects handlers synchronously.

### collectHandlers

    public void collectHandlers(Map<C,Map<,? super Boolean>> cache,
                                ExecutorService executor,
                                AtomicReference<Collection<Future<Collection<EventHandlerWrapper<E,P,C,K,H,S>>>>> collector,
                                E event)

  Collects handlers asynchronously.

  Parameters:
    `cache` - Cache of extracted values.
    `executor` - Executor for asynchronous handler collection.
    `collector` - Collector of handlers.
    `event` - Event to match.

### remove

    public boolean remove(List<PredicatedInferenceNode<E,P,C,K,H,S>> parentTrueChildren,
                          List<PredicatedInferenceNode<E,P,C,K,H,S>> parentFalseChildren,
                          boolean isTrueChild,
                          Iterable<K> keys)

  Removes handler(s) specified by the key(s).

  Parameters:
    `parentTrueChildren` - Parent true children list or even bus root nodes list. If a node doesn't have its own handlers and only sub-nodes and all sub-nodes are more restrictive, it promotes the sub-nodes to the parent/root and removes itself from the inference network. Null for the root node.
    `parentFalseChildren` - Same purpose as above. Null for the root node.
    `isTrueChild` - True if this node is a true child of parent. Always true for the root nodes.
  Returns:
    True if the node still has children or handlers and shall be retained in the network.

### reset

    public void reset()

  Resets state of the node and its children.

### getAllHandlers

    public Collection<EventHandlerWrapper<E,P,C,K,H,S>> getAllHandlers()

  This method is used when this node is moved under another node. In this case the node is removed and all its handlers are re-added to the root.

  Returns:
    All handlers from this node and sub-nodes.

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