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

COVERAGE SUMMARY FOR SOURCE FILE [RequiredComponentDescription.java]

nameclass, %method, %block, %line, %
RequiredComponentDescription.java100% (1/1)67%  (6/9)57%  (51/90)63%  (13.9/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RequiredComponentDescription100% (1/1)67%  (6/9)57%  (51/90)63%  (13.9/22)
hashCode (): int 0%   (0/1)0%   (0/8)0%   (0/1)
isOptional (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/22)0%   (0/5)
equals (Object): boolean 100% (1/1)77%  (20/26)72%  (2.9/4)
RequiredComponentDescription (String, IVersionRange): void 100% (1/1)100% (7/7)100% (2/2)
RequiredComponentDescription (String, IVersionRange, boolean, boolean): void 100% (1/1)100% (15/15)100% (6/6)
getId (): String 100% (1/1)100% (3/3)100% (1/1)
getVersionRange (): IVersionRange 100% (1/1)100% (3/3)100% (1/1)
isExported (): boolean 100% (1/1)100% (3/3)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 2007, 2008 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;
12 
13import org.eclipse.pde.api.tools.internal.provisional.IRequiredComponentDescription;
14import org.eclipse.pde.api.tools.internal.provisional.IVersionRange;
15 
16/**
17 * Implementation of a required component description based on
18 * OSGi bundles.
19 * 
20 * @since 1.0.0
21 */
22public class RequiredComponentDescription implements IRequiredComponentDescription {
23        
24        private String fId;
25        private boolean fIsOptional;
26        private boolean fIsExprted;
27        private IVersionRange fRange;
28        
29        
30        /**
31         * Constructs a new required component description based on the given
32         * required component id and version range. The required component description is
33         * mandatory. 
34         * 
35         * @param id component's symbolic name
36         * @param range version range
37         */
38        public RequiredComponentDescription(String id, IVersionRange range) {
39                this(id, range, false, false);
40        }
41        
42        /**
43         * Constructs a new required component description based on the given
44         * required component id and version range. 
45         * 
46         * @param id component's symbolic name
47         * @param range version range
48         * @param isOptional the optional flag of the required component
49         * @param isExported whether the required component is re-exported by the declaring component
50         */
51        public RequiredComponentDescription(String id, IVersionRange range, boolean isOptional, boolean isExported) {
52                fId = id;
53                fRange = range;
54                fIsOptional = isOptional;
55                fIsExprted = isExported;
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 RequiredComponentDescription) {
63                        RequiredComponentDescription desc = (RequiredComponentDescription) obj;
64                        return fId.equals(desc.fId) && fRange.equals(desc.fRange);
65                }
66                return super.equals(obj);
67        }
68 
69        /* (non-Javadoc)
70         * @see IRequiredComponentDescription#getId()
71         */
72        public String getId() {
73                return fId;
74        }
75 
76        /** (non-Javadoc)
77         * @see IRequiredComponentDescription#getVersionRange()
78         */
79        public IVersionRange getVersionRange() {
80                return fRange;
81        }
82 
83        /* (non-Javadoc)
84         * @see java.lang.Object#hashCode()
85         */
86        public int hashCode() {
87                return fId.hashCode() + fRange.hashCode();
88        }
89 
90        /* (non-Javadoc)
91         * @see IRequiredComponentDescription#isOptional()
92         */
93        public boolean isOptional() {
94                return this.fIsOptional;
95        }
96        /* (non-Javadoc)
97         * @see java.lang.Object#toString()
98         */
99        public String toString() {
100                StringBuffer buf = new StringBuffer();
101                buf.append(fId);
102                buf.append(' ');
103                buf.append(fRange.toString());
104                return buf.toString();
105        }
106 
107        /* (non-Javadoc)
108         * @see org.eclipse.pde.api.tools.internal.provisional.IRequiredComponentDescription#isExported()
109         */
110        public boolean isExported() {
111                return fIsExprted;
112        }
113 
114}

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