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

nameclass, %method, %block, %line, %
FieldDescriptorImpl.java100% (1/1)80%  (4/5)61%  (37/61)54%  (7/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FieldDescriptorImpl100% (1/1)80%  (4/5)61%  (37/61)54%  (7/13)
toString (): String 0%   (0/1)0%   (0/22)0%   (0/5)
equals (Object): boolean 100% (1/1)92%  (22/24)75%  (3/4)
FieldDescriptorImpl (String, IReferenceTypeDescriptor): void 100% (1/1)100% (5/5)100% (2/2)
getElementType (): int 100% (1/1)100% (2/2)100% (1/1)
hashCode (): int 100% (1/1)100% (8/8)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.descriptors;
12 
13import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor;
14import org.eclipse.pde.api.tools.internal.provisional.descriptors.IFieldDescriptor;
15import org.eclipse.pde.api.tools.internal.provisional.descriptors.IReferenceTypeDescriptor;
16 
17/**
18 * Description of a field.
19 * 
20 * @since 1.0.0
21 */
22public class FieldDescriptorImpl extends MemberDescriptorImpl implements IFieldDescriptor {
23        
24        /**
25         * Constructs a field descriptor with the given name, declared by the given type.
26         * 
27         * @param name field name
28         * @param parent type containing the field declaration
29         */
30        FieldDescriptorImpl(String name, IReferenceTypeDescriptor parent) {
31                super(name, parent);
32        }
33 
34        /* (non-Javadoc)
35         * @see java.lang.Object#toString()
36         */
37        public String toString() {
38                StringBuffer buffer = new StringBuffer();
39                buffer.append(getEnclosingType().getQualifiedName());
40                buffer.append("#"); //$NON-NLS-1$
41                buffer.append(getName());
42                return buffer.toString();
43        }
44        
45        /* (non-Javadoc)
46         * @see java.lang.Object#equals(java.lang.Object)
47         */
48        public boolean equals(Object obj) {
49                if (obj instanceof IFieldDescriptor) {
50                        IFieldDescriptor field = (IFieldDescriptor) obj;
51                        return getName().equals(field.getName()) && getEnclosingType().equals(field.getEnclosingType());
52                }
53                return false;
54        }
55        
56        /* (non-Javadoc)
57         * @see java.lang.Object#hashCode()
58         */
59        public int hashCode() {
60                return getName().hashCode() + getEnclosingType().hashCode();
61        }                
62        
63        /* (non-Javadoc)
64         * @see org.eclipse.pde.api.tools.model.component.IElementDescriptor#getElementType()
65         */
66        public int getElementType() {
67                return IElementDescriptor.FIELD;
68        }        
69}

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