EMMA Coverage Report (generated Thu Nov 26 15:54:18 CST 2009)
[all classes][org.eclipse.pde.api.tools.internal.provisional.comparator]

COVERAGE SUMMARY FOR SOURCE FILE [CompareApiScopeVisitor.java]

nameclass, %method, %block, %line, %
CompareApiScopeVisitor.java100% (5/5)100% (15/15)79%  (250/317)73%  (63.8/87)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompareApiScopeVisitor100% (1/1)100% (7/7)74%  (183/247)70%  (50.8/72)
visit (IApiTypeRoot): void 100% (1/1)63%  (12/19)57%  (3.4/6)
visit (IApiComponent): boolean 100% (1/1)66%  (54/82)60%  (11.3/19)
visit (IApiTypeContainer): boolean 100% (1/1)68%  (15/22)61%  (3.7/6)
visit (IApiBaseline): boolean 100% (1/1)74%  (28/38)61%  (5.5/9)
compareApiTypeRoot (IApiTypeRoot): void 100% (1/1)81%  (50/62)78%  (17.9/23)
CompareApiScopeVisitor (Set, IApiBaseline, boolean, int, IProgressMonitor): void 100% (1/1)100% (21/21)100% (8/8)
containsError (): boolean 100% (1/1)100% (3/3)100% (1/1)
     
class CompareApiScopeVisitor$2100% (1/1)100% (2/2)84%  (16/19)71%  (5/7)
visit (String, IApiTypeRoot): void 100% (1/1)77%  (10/13)60%  (3/5)
CompareApiScopeVisitor$2 (CompareApiScopeVisitor): void 100% (1/1)100% (6/6)100% (2/2)
     
class CompareApiScopeVisitor$1100% (1/1)100% (2/2)100% (17/17)100% (5/5)
CompareApiScopeVisitor$1 (CompareApiScopeVisitor): void 100% (1/1)100% (6/6)100% (2/2)
endVisit (IDelta): void 100% (1/1)100% (11/11)100% (3/3)
     
class CompareApiScopeVisitor$3100% (1/1)100% (2/2)100% (17/17)100% (5/5)
CompareApiScopeVisitor$3 (CompareApiScopeVisitor): void 100% (1/1)100% (6/6)100% (2/2)
endVisit (IDelta): void 100% (1/1)100% (11/11)100% (3/3)
     
class CompareApiScopeVisitor$4100% (1/1)100% (2/2)100% (17/17)100% (5/5)
CompareApiScopeVisitor$4 (CompareApiScopeVisitor): void 100% (1/1)100% (6/6)100% (2/2)
endVisit (IDelta): void 100% (1/1)100% (11/11)100% (3/3)

1/*******************************************************************************
2 * Copyright (c) 2008, 2009 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *     IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.pde.api.tools.internal.provisional.comparator;
12 
13import java.util.Set;
14 
15import org.eclipse.core.runtime.CoreException;
16import org.eclipse.core.runtime.IProgressMonitor;
17import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
18import org.eclipse.pde.api.tools.internal.provisional.model.ApiScopeVisitor;
19import org.eclipse.pde.api.tools.internal.provisional.model.ApiTypeContainerVisitor;
20import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
21import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
22import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeContainer;
23import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot;
24import org.eclipse.pde.api.tools.internal.util.Util;
25 
26/**
27 * ApiScope visitor implementation to run the comparison on all elements of the scope.
28 */
29public class CompareApiScopeVisitor extends ApiScopeVisitor {
30 
31        Set deltas;
32        IApiBaseline referenceBaseline;
33        int visibilityModifiers;
34        boolean force;
35        boolean containsErrors = false;
36        IProgressMonitor monitor;
37 
38        public CompareApiScopeVisitor(
39                        final Set deltas,
40                        final IApiBaseline baseline,
41                        final boolean force,
42                        final int visibilityModifiers,
43                        final IProgressMonitor monitor) {
44                this.deltas = deltas;
45                this.referenceBaseline = baseline;
46                this.visibilityModifiers = visibilityModifiers;
47                this.force = force;
48                this.monitor = monitor;
49        }
50        
51        public boolean visit(IApiBaseline baseline) throws CoreException {
52                try {
53                        Util.updateMonitor(this.monitor);
54                        IDelta delta = ApiComparator.compare(this.referenceBaseline, baseline, this.visibilityModifiers, this.force, null);
55                        if (delta != null) {
56                                delta.accept(new DeltaVisitor() {
57                                        public void endVisit(IDelta localDelta) {
58                                                if (localDelta.getChildren().length == 0) {
59                                                        CompareApiScopeVisitor.this.deltas.add(localDelta);
60                                                }
61                                        }
62                                });
63                        } else {
64                                this.containsErrors = true;
65                        }
66                        return false;
67                } finally {
68                        this.monitor.worked(1);
69                }
70        }
71 
72        public boolean visit(IApiTypeContainer container) throws CoreException {
73                try {
74                        Util.updateMonitor(this.monitor);
75                        container.accept(new ApiTypeContainerVisitor() {
76                                public void visit(String packageName, IApiTypeRoot typeroot) {
77                                        try {
78                                                Util.updateMonitor(CompareApiScopeVisitor.this.monitor);
79                                                compareApiTypeRoot(typeroot);
80                                        } catch (CoreException e) {
81                                                ApiPlugin.log(e);
82                                        }
83                                }
84                        });
85                        return false;
86                } finally {
87                        this.monitor.worked(1);
88                }
89        }
90 
91        public boolean visit(IApiComponent component) throws CoreException {
92                try {
93                        Util.updateMonitor(this.monitor);
94                        if (component.getErrors() != null) {
95                                this.containsErrors = true;
96                                return false;
97                        }
98                        IApiComponent referenceComponent = this.referenceBaseline.getApiComponent(component.getId());
99                        if (referenceComponent != null && referenceComponent.getErrors() != null) {
100                                this.containsErrors = true;
101                                return false;
102                        }
103                        if (component.isSourceComponent() || component.isSystemComponent()) {
104                                return false;
105                        }
106                        Util.updateMonitor(this.monitor);
107                        IDelta delta = ApiComparator.compare(referenceComponent, component, this.visibilityModifiers, null);
108                        if (delta != null) {
109                                delta.accept(new DeltaVisitor() {
110                                        public void endVisit(IDelta localDelta) {
111                                                if (localDelta.getChildren().length == 0) {
112                                                        CompareApiScopeVisitor.this.deltas.add(localDelta);
113                                                }
114                                        }
115                                });
116                        } else {
117                                this.containsErrors = true;
118                        }
119                        return false;
120                } finally {
121                        this.monitor.worked(1);
122                }
123        }
124        
125        public void visit(IApiTypeRoot root) throws CoreException {
126                try {
127                        Util.updateMonitor(this.monitor);
128                        compareApiTypeRoot(root);
129                } finally {
130                        this.monitor.worked(1);
131                }
132        }
133 
134        void compareApiTypeRoot(IApiTypeRoot root) throws CoreException {
135                IApiComponent apiComponent = root.getApiComponent();
136                if (apiComponent == null || apiComponent.isSystemComponent() || apiComponent.isSourceComponent()) {
137                        return;
138                }
139                if (apiComponent.getErrors() != null) {
140                        this.containsErrors = true;
141                        return;
142                }
143                IApiComponent referenceComponent = this.referenceBaseline.getApiComponent(apiComponent.getId());
144                if (referenceComponent == null) return;
145                if (referenceComponent.getErrors() != null) {
146                        this.containsErrors = true;
147                        return;
148                }
149                IApiBaseline baseline = referenceComponent.getBaseline();
150                IDelta delta = ApiComparator.compare(
151                                root,
152                                referenceComponent,
153                                apiComponent,
154                                this.referenceBaseline,
155                                baseline,
156                                this.visibilityModifiers, null);
157                if (delta != null) {
158                        delta.accept(new DeltaVisitor() {
159                                public void endVisit(IDelta localDelta) {
160                                        if (localDelta.getChildren().length == 0) {
161                                                CompareApiScopeVisitor.this.deltas.add(localDelta);
162                                        }
163                                }
164                        });
165                } else {
166                        this.containsErrors = true;
167                }
168        }
169        
170        public boolean containsError() {
171                return this.containsErrors;
172        }
173}

[all classes][org.eclipse.pde.api.tools.internal.provisional.comparator]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov