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

COVERAGE SUMMARY FOR SOURCE FILE [ElementDescriptorImpl.java]

nameclass, %method, %block, %line, %
ElementDescriptorImpl.java100% (1/1)83%  (5/6)72%  (43/60)71%  (12/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ElementDescriptorImpl100% (1/1)83%  (5/6)72%  (43/60)71%  (12/17)
setDebug (boolean): void 0%   (0/1)0%   (0/9)0%   (0/2)
compareTo (Object): int 100% (1/1)60%  (12/20)50%  (3/6)
<static initializer> 100% (1/1)100% (3/3)100% (2/2)
ElementDescriptorImpl (): void 100% (1/1)100% (3/3)100% (1/1)
getParent (): IElementDescriptor 100% (1/1)100% (2/2)100% (1/1)
getPath (): IElementDescriptor [] 100% (1/1)100% (23/23)100% (6/6)

1/*******************************************************************************
2 * Copyright (c) 2007, 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.descriptors;
12 
13import java.util.ArrayList;
14import java.util.List;
15 
16import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor;
17import org.eclipse.pde.api.tools.internal.util.Util;
18 
19/**
20 * Common base class for element descriptors.
21 * 
22 * @since 1.0.0
23 */
24public abstract class ElementDescriptorImpl implements IElementDescriptor, Comparable {
25 
26        /**
27         * Constant used for controlling tracing in the descriptor framework
28         */
29        private static boolean Debug = Util.DEBUG;
30        
31        /**
32         * Method used for initializing tracing in the descriptor framework
33         */
34        public static void setDebug(boolean debugValue) {
35                Debug = debugValue || Util.DEBUG;
36        }
37        
38        /* (non-Javadoc)
39         * @see org.eclipse.pde.api.tools.model.component.IElementDescriptor#getParent()
40         */
41        public IElementDescriptor getParent() {
42                return null;
43        }
44 
45        /* (non-Javadoc)
46         * @see org.eclipse.pde.api.tools.model.component.IElementDescriptor#getPath()
47         */
48        public IElementDescriptor[] getPath() {
49                List list = new ArrayList();
50                IElementDescriptor element = this;
51                while (element != null) {
52                        list.add(0, element);
53                        element = element.getParent();
54                }
55                return (IElementDescriptor[]) list.toArray(new IElementDescriptor[list.size()]);
56        }
57 
58        /* (non-Javadoc)
59         * @see java.lang.Comparable#compareTo(java.lang.Object)
60         */
61        public int compareTo(Object o) {
62                if (o instanceof ElementDescriptorImpl) {
63                        ElementDescriptorImpl element = (ElementDescriptorImpl) o;
64                        return getComparable().compareTo(element.getComparable());
65                }
66                if (Debug) {
67                        System.err.println(o.getClass());
68                }
69                return -1;
70        }
71 
72        /**
73         * Returns this element's comparable delegate.
74         * 
75         * @return comparable
76         */
77        protected abstract Comparable getComparable();
78}

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