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

COVERAGE SUMMARY FOR SOURCE FILE [True.java]

nameclass, %method, %block, %line, %
True.java100% (1/1)100% (10/10)72%  (132/184)62%  (17.9/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class True100% (1/1)100% (10/10)72%  (132/184)62%  (17.9/29)
compareTo (Extractor): ComparisonResult 100% (1/1)38%  (25/65)42%  (8/19)
$SWITCH_TABLE$com$hammurapi$extract$ComparisonResult$Type (): int [] 100% (1/1)88%  (85/97)87%  (0.9/1)
<static initializer> 100% (1/1)100% (5/5)100% (2/2)
True (): void 100% (1/1)100% (3/3)100% (2/2)
extract (Object, Map, Object []): Boolean 100% (1/1)100% (2/2)100% (1/1)
getCost (): double 100% (1/1)100% (2/2)100% (1/1)
getInstance (): True 100% (1/1)100% (2/2)100% (1/1)
isContextDependent (): boolean 100% (1/1)100% (2/2)100% (1/1)
parameterIndices (): Set 100% (1/1)100% (2/2)100% (1/1)
toString (): String 100% (1/1)100% (4/4)100% (1/1)

1package com.hammurapi.extract;
2 
3import java.util.Collections;
4import java.util.Map;
5import java.util.Set;
6 
7 
8/**
9 * Predicate which always evaluates to true. This predicate is primarily used for
10 * comparison 
11 * @author Pavel Vlasov
12 *
13 * @param <T>
14 * @param <C>
15 */
16public class True<T, C> implements Predicate<T, C> {
17        
18        private True() {
19                // Singleton
20        }
21        
22        private static True<?, ?> INSTANCE = new True<Object, Object>();
23        
24        @SuppressWarnings("unchecked")
25        public static <T, C> True<T, C> getInstance() {
26                return (True<T, C>) INSTANCE;
27        }
28 
29        public ComparisonResult compareTo(Extractor<T, Boolean, C> otherPredicate) {
30                if (otherPredicate instanceof True) {
31                        return ComparisonResult.EQUAL_NM;
32                }
33                
34                if (otherPredicate instanceof False) {
35                        return ComparisonResult.OPPOSITE_NM;
36                }
37                
38                
39                if (otherPredicate == null) {
40                        return ComparisonResult.NOT_EQUAL_NM;
41                }
42 
43                if (otherPredicate instanceof Constant) {
44                        if (Boolean.TRUE.equals(((Constant) otherPredicate).getValue())) {
45                                return ComparisonResult.EQUAL_NM;
46                        }
47                        if (Boolean.FALSE.equals(((Constant) otherPredicate).getValue())) {
48                                return ComparisonResult.OPPOSITE_NM;
49                        }
50                }
51                
52                ComparisonResult cr = otherPredicate.compareTo(this);
53                switch (cr.getType()) {
54                case EQUAL:
55                case NOT_EQUAL:
56                case OPPOSITE:
57                        return cr;
58                case LESS_RESTRICTIVE:
59                        return ComparisonResult.MORE_RESTRICTIVE_NM;
60                case MORE_RESTRICTIVE:
61                        return ComparisonResult.LESS_RESTRICTIVE_NM;
62                case OPPOSITE_LESS_RESTRICTIVE:
63                        return ComparisonResult.OPPOSITE_MORE_RESTRICTIVE_NM;
64                case OPPOSITE_MORE_RESTRICTIVE:
65                        return ComparisonResult.OPPOSITE_LESS_RESTRICTIVE_NM;
66                default:
67                        throw new IllegalArgumentException("Unexpected comparison type: "+cr.getType());
68                }
69        }
70 
71        public Boolean extract(
72                        C context,
73                        Map<C, Map<Extractor<T, ? super Boolean, C>, ? super Boolean>> cache,
74                        T... obj) {
75                return Boolean.TRUE;
76        }
77 
78        public boolean isContextDependent() {
79                return false;
80        }
81 
82        public Set<Integer> parameterIndices() {
83                return Collections.emptySet();
84        }
85        
86        @Override
87        public String toString() {
88                return getClass().getName();
89        }
90        
91        @Override
92        public double getCost() {
93                return 0;
94        }
95 
96}

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