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 [ComponentDescriptorImpl.java]

nameclass, %method, %block, %line, %
ComponentDescriptorImpl.java100% (1/1)100% (8/8)86%  (64/74)90%  (19/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComponentDescriptorImpl100% (1/1)100% (8/8)86%  (64/74)90%  (19/21)
equals (Object): boolean 100% (1/1)67%  (20/30)67%  (4/6)
ComponentDescriptorImpl (String, String): void 100% (1/1)100% (16/16)100% (6/6)
getElementType (): int 100% (1/1)100% (2/2)100% (1/1)
getId (): String 100% (1/1)100% (3/3)100% (1/1)
getPath (): IElementDescriptor [] 100% (1/1)100% (2/2)100% (1/1)
getVersion (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (15/15)100% (4/4)
toString (): String 100% (1/1)100% (3/3)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 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 org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor;
14import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor;
15 
16/**
17 * Base implementation of {@link IComponentDescriptor}
18 * 
19 * @since 1.0.1
20 * 
21 * @noextend This class is not intended to be subclassed by clients.
22 * @noinstantiate This class is not intended to be instantiated by clients.
23 */
24public class ComponentDescriptorImpl extends NamedElementDescriptorImpl implements IComponentDescriptor {
25 
26        private String componentid = null;
27        private String version = null;
28        
29        /**
30         * Constructor
31         * @param componentid
32         */
33        public ComponentDescriptorImpl(String componentid, String version) {
34                super(componentid);
35                this.componentid = componentid;
36                this.version = version;
37                
38        }
39        
40        /* (non-Javadoc)
41         * @see org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor#getElementType()
42         */
43        public int getElementType() {
44                return COMPONENT;
45        }
46 
47        /* (non-Javadoc)
48         * @see java.lang.Object#hashCode()
49         */
50        public int hashCode() {
51                int hc = 0;
52                if (version != null) {
53                        hc = version.hashCode();
54                }
55                return this.componentid.hashCode() + hc;
56        }
57        
58        /* (non-Javadoc)
59         * @see java.lang.Object#equals(java.lang.Object)
60         */
61        public boolean equals(Object obj) {
62                if(obj instanceof IComponentDescriptor) {
63                        if (this.componentid.equals(((IComponentDescriptor)obj).getId())) {
64                                if (this.version == null) {
65                                        return ((IComponentDescriptor)obj).getVersion() == null;
66                                } else {
67                                        return this.version.equals(((IComponentDescriptor)obj).getVersion());
68                                }
69                        }
70                }
71                return false;
72        }
73        
74        /* (non-Javadoc)
75         * @see org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor#getId()
76         */
77        public String getId() {
78                return this.componentid;
79        }
80 
81        /* (non-Javadoc)
82         * @see org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor#getPath()
83         */
84        public IElementDescriptor[] getPath() {
85                return null;
86        }
87 
88        /* (non-Javadoc)
89         * @see java.lang.Object#toString()
90         */
91        public String toString() {
92                return this.componentid;
93        }
94 
95        /* (non-Javadoc)
96         * @see org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor#getVersion()
97         */
98        public String getVersion() {
99                return version;
100        }
101        
102}

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