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

nameclass, %method, %block, %line, %
MethodDescriptorImpl.java100% (1/1)100% (7/7)98%  (82/84)94%  (17/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MethodDescriptorImpl100% (1/1)100% (7/7)98%  (82/84)94%  (17/18)
equals (Object): boolean 100% (1/1)93%  (28/30)83%  (5/6)
MethodDescriptorImpl (String, IReferenceTypeDescriptor, String): void 100% (1/1)100% (8/8)100% (3/3)
getElementType (): int 100% (1/1)100% (2/2)100% (1/1)
getSignature (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (8/8)100% (1/1)
isConstructor (): boolean 100% (1/1)100% (5/5)100% (1/1)
toString (): String 100% (1/1)100% (28/28)100% (5/5)

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.descriptors;
12 
13import org.eclipse.jdt.core.Signature;
14import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor;
15import org.eclipse.pde.api.tools.internal.provisional.descriptors.IMethodDescriptor;
16import org.eclipse.pde.api.tools.internal.provisional.descriptors.IReferenceTypeDescriptor;
17 
18/**
19 * Description of a method.
20 * 
21 * @since 1.0.0
22 */
23public class MethodDescriptorImpl extends MemberDescriptorImpl implements IMethodDescriptor {
24        
25        /**
26         * Method signature
27         */
28        private String fSignature;
29                
30        /**
31         * Constructs a method descriptor.
32         * 
33         * @param name method name
34         * @param enclosingType enclosing type
35         * @param signature method signature
36         */
37        MethodDescriptorImpl(String name, IReferenceTypeDescriptor enclosingType, String signature) {
38                super(name, enclosingType);
39                fSignature = signature;
40        }
41        
42        /* (non-Javadoc)
43         * @see java.lang.Object#toString()
44         */
45        public String toString() {
46                StringBuffer buffer = new StringBuffer();
47                buffer.append(getEnclosingType().getQualifiedName());
48                buffer.append("#"); //$NON-NLS-1$
49                buffer.append(Signature.toString(getSignature(), getName(), null, true, true));
50                return buffer.toString();
51        }
52 
53        /* (non-Javadoc)
54         * @see java.lang.Object#equals(java.lang.Object)
55         */
56        public boolean equals(Object obj) {
57                if (obj instanceof IMethodDescriptor) {
58                        IMethodDescriptor method = (IMethodDescriptor) obj;
59                        return getName().equals(method.getName())
60                                        && getEnclosingType().equals(method.getEnclosingType())
61                                        && getSignature().equals(method.getSignature());
62                }
63                return false;
64        }
65        
66        /* (non-Javadoc)
67         * @see java.lang.Object#hashCode()
68         */
69        public int hashCode() {
70                return getName().hashCode() + getEnclosingType().hashCode();
71        }        
72        
73        /* (non-Javadoc)
74         * @see org.eclipse.pde.api.tools.model.component.IElementDescriptor#getElementType()
75         */
76        public int getElementType() {
77                return IElementDescriptor.METHOD;
78        }
79 
80        /* (non-Javadoc)
81         * @see org.eclipse.pde.api.tools.model.component.IMethodDescriptor#getSignature()
82         */
83        public String getSignature() {
84                return fSignature;
85        }
86        
87        /* (non-Javadoc)
88         * @see org.eclipse.pde.api.tools.internal.provisional.descriptors.IMethodDescriptor#isConstructor()
89         */
90        public boolean isConstructor() {
91                return "<init>".equals(getName()); //$NON-NLS-1$
92        }
93}

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