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

COVERAGE SUMMARY FOR SOURCE FILE [MappedPredicate.java]

nameclass, %method, %block, %line, %
MappedPredicate.java100% (1/1)100% (2/2)94%  (33/35)91%  (10/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MappedPredicate100% (1/1)100% (2/2)94%  (33/35)91%  (10/11)
mapPredicate (Predicate, int []): Predicate 100% (1/1)93%  (28/30)89%  (8/9)
MappedPredicate (Predicate, int []): void 100% (1/1)100% (5/5)100% (2/2)

1package com.hammurapi.extract;
2 
3 
4/**
5 * Extractor which maps arguments to the target extractor.
6 * @author Pavel Vlasov
7 *
8 * @param <T>
9 * @param <V>
10 * @param <C>
11 */
12public class MappedPredicate<T, C> extends MappedExtractor<T, Boolean, C> implements Predicate<T, C> {
13 
14        /**
15         * @param target Target extractor
16         * @param map Index map, e.g. if it is {5, 3} then the first argument
17         * of this extractor becomes the sixth argument of the target extractor
18         * and the second argument of this extractor becomes the 4th argument
19         * of the target extractor. 
20         */
21        protected MappedPredicate(Predicate<T, C> target, int[] map) {
22                super(target, map);
23        }
24        
25        public static <T,C> Predicate<T,C> mapPredicate(Predicate<T,C> target, int[] map) {
26                if (ComparisonResult.isOneToOneMapping(map)) {
27                        return target;
28                }
29                
30                // Target is not index-dependent (e.g. constant).
31                if (target.parameterIndices().isEmpty()) {
32                        return target;
33                }
34                if (target instanceof Mappable) {
35                        @SuppressWarnings("unchecked")
36                        Extractor<T, Boolean, C> ret = ((Mappable<T,Boolean,C>) target).map(map);
37                        if (ret!=null) {
38                                return ExtractorUtil.wrap(ret);
39                        }
40                }
41                
42                return new MappedPredicate<T, C>(target, map);
43        }
44        
45 
46}

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