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

COVERAGE SUMMARY FOR SOURCE FILE [SignatureDescriptor.java]

nameclass, %method, %block, %line, %
SignatureDescriptor.java100% (1/1)90%  (9/10)74%  (178/242)82%  (41/50)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SignatureDescriptor100% (1/1)90%  (9/10)74%  (178/242)82%  (41/50)
toString (): String 0%   (0/1)0%   (0/64)0%   (0/9)
<static initializer> 100% (1/1)100% (7/7)100% (3/3)
SignatureDescriptor (): void 100% (1/1)100% (3/3)100% (2/2)
addInterfaceBound (String): void 100% (1/1)100% (5/5)100% (2/2)
addTypeArgument (String): void 100% (1/1)100% (44/44)100% (8/8)
addTypeParameterDescriptor (String): void 100% (1/1)100% (52/52)100% (10/10)
getTypeArguments (): String [] 100% (1/1)100% (29/29)100% (6/6)
getTypeParameterDescriptors (): TypeParameterDescriptor [] 100% (1/1)100% (29/29)100% (6/6)
setClassBound (String): void 100% (1/1)100% (5/5)100% (2/2)
setSuperclass (String): void 100% (1/1)100% (4/4)100% (2/2)

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.comparator;
12 
13class SignatureDescriptor {
14        private static final TypeParameterDescriptor[] EMPTY_TYPE_PARAMETER_DESCRIPTORS = new TypeParameterDescriptor[0];
15        private static final String[] EMPTY_TYPE_ARGUMENTS = new String[0];
16        static final int INITIAL_SIZE = 1;
17        
18        TypeParameterDescriptor currentTypeParameterDescriptor;
19        String superClass;
20        TypeParameterDescriptor[] typeParameterDescriptors;
21        int typeParameterDescriptorsCounter;
22        String[] typeArguments;
23        int typeArgumentsCounter;
24        
25        public SignatureDescriptor() {
26        }
27        
28        public void addInterfaceBound(String bound) {
29                this.currentTypeParameterDescriptor.addInterfaceBound(bound);
30        }
31 
32        public void addTypeArgument(String typeArgument) {
33                if (this.typeArguments == null) {
34                        this.typeArguments = new String[INITIAL_SIZE];
35                        this.typeArgumentsCounter = 0;
36                } else {
37                        int length = typeArguments.length; 
38                        if (length == this.typeArgumentsCounter) {
39                                // resize
40                                System.arraycopy(this.typeArguments, 0, (this.typeArguments = new String[length * 2]), 0, length);
41                        }
42                }
43                this.typeArguments[this.typeArgumentsCounter++] = typeArgument;
44        }
45 
46        public void addTypeParameterDescriptor(String name) {
47                if (this.typeParameterDescriptors == null) {
48                        this.typeParameterDescriptors = new TypeParameterDescriptor[INITIAL_SIZE];
49                        this.typeParameterDescriptorsCounter = 0;
50                } else {
51                        int length = this.typeParameterDescriptors.length;
52                        if (this.typeParameterDescriptorsCounter == length) {
53                                System.arraycopy(this.typeParameterDescriptors, 0, (this.typeParameterDescriptors = new TypeParameterDescriptor[length * 2]), 0, length);
54                        }
55                }
56                TypeParameterDescriptor typeParameterDescriptor = new TypeParameterDescriptor(name);
57                this.currentTypeParameterDescriptor = typeParameterDescriptor;
58                this.typeParameterDescriptors[this.typeParameterDescriptorsCounter++] = typeParameterDescriptor;
59        }
60 
61        public TypeParameterDescriptor[] getTypeParameterDescriptors() {
62                if (this.typeParameterDescriptors == null) {
63                        return EMPTY_TYPE_PARAMETER_DESCRIPTORS;
64                }
65                int length = this.typeParameterDescriptors.length;
66                if (this.typeParameterDescriptorsCounter != length) {
67                        System.arraycopy(this.typeParameterDescriptors, 0, (this.typeParameterDescriptors = new TypeParameterDescriptor[this.typeParameterDescriptorsCounter]), 0, this.typeParameterDescriptorsCounter);
68                }
69                return this.typeParameterDescriptors;
70        }
71 
72        public String[] getTypeArguments() {
73                if (this.typeArguments == null) {
74                        return EMPTY_TYPE_ARGUMENTS;
75                }
76                int length = this.typeArguments.length;
77                if (this.typeArgumentsCounter != length) {
78                        System.arraycopy(this.typeArguments, 0, (this.typeArguments= new String[this.typeArgumentsCounter]), 0, this.typeArgumentsCounter);
79                }
80                return this.typeArguments;
81        }
82 
83        public void setClassBound(String bound) {
84                this.currentTypeParameterDescriptor.setClassBound(bound);
85        }
86        
87        public void setSuperclass(String superclass) {
88                this.superClass = superclass;
89        }
90 
91        public String toString() {
92                StringBuffer buffer = new StringBuffer();
93                for (int i = 0, max = this.typeParameterDescriptorsCounter; i < max; i++) {
94                        if (i > 0) buffer.append(',');
95                        buffer.append(this.typeParameterDescriptors[i]);
96                }
97                buffer.append("superclass: " + this.superClass); //$NON-NLS-1$
98                for (int i = 0, max = this.typeArgumentsCounter; i < max; i++) {
99                        if (i > 0) buffer.append(',');
100                        buffer.append(this.typeArguments[i]);
101                }
102                return String.valueOf(buffer);
103        }
104}

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