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

COVERAGE SUMMARY FOR SOURCE FILE [PostCommand.java]

nameclass, %method, %block, %line, %
PostCommand.java100% (1/1)100% (8/8)89%  (78/88)91%  (20/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PostCommand100% (1/1)100% (8/8)89%  (78/88)91%  (20/22)
getEvent (): Object 100% (1/1)55%  (6/11)67%  (2/3)
getHandle (): AbstractEventBus$Handle 100% (1/1)55%  (6/11)67%  (2/3)
PostCommand (AbstractEventBus$Handle, Object, EventHandler, AbstractEventBus$... 100% (1/1)100% (13/13)100% (4/4)
PostCommand (Object, boolean, Object, EventHandler, AbstractEventBus$Handle [... 100% (1/1)100% (16/16)100% (5/5)
getValidators (): Predicate [] 100% (1/1)100% (3/3)100% (1/1)
isDirectPost (): boolean 100% (1/1)100% (3/3)100% (1/1)
isHandleMode (): boolean 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (28/28)100% (4/4)

1package com.hammurapi.eventbus;
2 
3import java.util.Arrays;
4 
5import com.hammurapi.eventbus.AbstractEventBus.Handle;
6import com.hammurapi.extract.Predicate;
7 
8 
9/**
10 * @author Pavel Vlasov
11 *
12 * @param <E>
13 * @param <P>
14 * @param <C>
15 * @param <H>
16 */
17public class PostCommand<E, P extends Comparable<P>, C, K, H extends EventBus.Handle<E,P,C>, S extends EventStore<E,P,C,H,S>> extends InferenceCommand<E,P,C,K,H,S> {
18        
19        private Predicate<E, S>[] validators;
20        private E event;
21        private boolean directPost;
22        private Handle<E,P,C,K> handle;
23        private boolean isHandleMode;
24 
25        public PostCommand(
26                        E event, 
27                        boolean directPost,
28                        K handlerId,
29                        EventHandler<E, P, C, H, S> handler,
30                        Handle<E,P,C,K>[] inputs, 
31                        InferenceContext<E,P,C,K,H,S> inferenceContext,
32                        Predicate<E, S>[] validators) {
33                super(handlerId, handler,inputs,inferenceContext);
34                this.event = event;
35                this.validators = validators;
36                this.directPost = directPost;
37        }
38 
39        /**
40         * For update
41         * @param handle
42         * @param directPost
43         * @param handlerId
44         * @param handler
45         * @param inputs
46         * @param inferenceContext
47         * @param validators
48         */
49        public PostCommand(
50                        Handle<E,P,C,K> handle, 
51                        K handlerId,
52                        EventHandler<E, P, C, H, S> handler,
53                        Handle<E,P,C,K>[] inputs, 
54                        InferenceContext<E,P,C,K,H,S> inferenceContext) {
55                super(handlerId, handler,inputs,inferenceContext);
56                this.handle = handle;
57                isHandleMode = true;
58        }
59 
60        public E getEvent() {
61                if (isHandleMode) {
62                        throw new IllegalStateException("Invoke getHandle() instead");
63                }
64                return event;
65        }
66        
67        public Handle<E, P, C, K> getHandle() {
68                if (!isHandleMode) {
69                        throw new IllegalStateException("Invoke getEvent() instead");
70                }
71                return handle;
72        }
73        
74        public boolean isHandleMode() {
75                return isHandleMode;
76        }
77 
78        public Predicate<E, S>[] getValidators() {
79                return validators;
80        }
81 
82        @Override
83        public String toString() {
84                return "PostCommand [event=" + event
85                                + ", handler=" + getHandler() + ", inputs="
86                                + Arrays.toString(getInputs()) + ", validators="
87                                + Arrays.toString(validators) + "]";
88        }
89 
90        public boolean isDirectPost() {
91                return directPost;
92        }
93        
94}
95        

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