EMMA Coverage Report (generated Thu Jan 20 11:39:44 EST 2011)
[all classes][com.hammurapi.eventbus]

COVERAGE SUMMARY FOR SOURCE FILE [DerivationLoopFilter.java]

nameclass, %method, %block, %line, %
DerivationLoopFilter.java0%   (0/1)0%   (0/2)0%   (0/37)0%   (0/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DerivationLoopFilter0%   (0/1)0%   (0/2)0%   (0/37)0%   (0/8)
DerivationLoopFilter (): void 0%   (0/1)0%   (0/3)0%   (0/1)
accept (InferenceCommand, EventBus): boolean 0%   (0/1)0%   (0/34)0%   (0/7)

1package com.hammurapi.eventbus;
2 
3 
4/**
5 * Discards post commands with derivation loops, i.e. when one of inputs is derived from the event. 
6 * @author Pavel Vlasov
7 */
8public class DerivationLoopFilter<E, P extends Comparable<P>, C, K, H extends EventBus.Handle<E,P,C>, S extends EventStore<E,P,C,H,S>> implements InferenceFilter<E,P,C,K,H,S> {
9        
10        public boolean accept(InferenceCommand<E,P,C,K,H,S> inferenceCommand, EventBus<E,P,C,K,H,S> bus) {
11                if (inferenceCommand instanceof PostCommand) {
12                        PostCommand<E,P,C,K,H,S> postCommand = (PostCommand<E,P,C,K,H,S>) inferenceCommand;
13                        E event = postCommand.getEvent();
14                        for (AbstractEventBus.Handle<E, P, C, K> handle: postCommand.getInputs()) {
15                                if (handle.isDerivedFrom(event)) {
16                                        return false;
17                                }
18                        }                        
19                }
20                return true;
21        }
22}

[all classes][com.hammurapi.eventbus]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov