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

nameclass, %method, %block, %line, %
ApiAccess.java100% (2/2)33%  (3/9)26%  (17/65)33%  (7/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ApiAccess100% (1/1)29%  (2/7)23%  (14/60)32%  (6/19)
equals (Object): boolean 0%   (0/1)0%   (0/15)0%   (0/3)
getAccessLevel (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getAccessText (int): String 0%   (0/1)0%   (0/8)0%   (0/4)
hashCode (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/17)0%   (0/4)
<static initializer> 100% (1/1)100% (5/5)100% (2/2)
ApiAccess (int): void 100% (1/1)100% (9/9)100% (4/4)
     
class ApiAccess$NormalAccess100% (1/1)50%  (1/2)60%  (3/5)50%  (1/2)
getAccessLevel (): int 0%   (0/1)0%   (0/2)0%   (0/1)
ApiAccess$NormalAccess (): void 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;
12 
13import org.eclipse.pde.api.tools.internal.provisional.IApiAccess;
14 
15/**
16 * Default implementation of {@link IApiAccess}
17 * 
18 * @since 1.0.1
19 * @noextend This class is not intended to be subclassed by clients.
20 * @noinstantiate This class is not intended to be instantiated by clients.
21 */
22public class ApiAccess implements IApiAccess {
23 
24        public static final IApiAccess NORMAL_ACCESS = new NormalAccess();
25        
26        static class NormalAccess implements IApiAccess {
27                /* (non-Javadoc)
28                 * @see org.eclipse.pde.api.tools.internal.provisional.IApiAccess#getAccessLevel()
29                 */
30                public int getAccessLevel() {
31                        return IApiAccess.NORMAL;
32                }
33        }
34        
35        private int access = IApiAccess.NORMAL;
36        
37        /**
38         * Constructor
39         * @param access
40         */
41        public ApiAccess(int access) {
42                this.access = access;
43        }
44        
45        /* (non-Javadoc)
46         * @see org.eclipse.pde.api.tools.internal.provisional.IApiAccess#getAccessLevel()
47         */
48        public int getAccessLevel() {
49                return this.access;
50        }
51 
52        /* (non-Javadoc)
53         * @see java.lang.Object#hashCode()
54         */
55        public int hashCode() {
56                return this.access;
57        }
58        
59        /* (non-Javadoc)
60         * @see java.lang.Object#equals(java.lang.Object)
61         */
62        public boolean equals(Object obj) {
63                if(obj instanceof IApiAccess) {
64                        return this.access == ((IApiAccess)obj).getAccessLevel();
65                }
66                return false;
67        }
68        
69        /* (non-Javadoc)
70         * @see java.lang.Object#toString()
71         */
72        public String toString() {
73                StringBuffer buffer = new StringBuffer();
74                buffer.append("Access Level: "); //$NON-NLS-1$
75                buffer.append(getAccessText(getAccessLevel()));
76                return buffer.toString();
77        }
78        
79        /**
80         * Returns a textual representation of an {@link IApiAccess}
81         * 
82         * @param access
83         * @return the textual representation of an {@link IApiAccess}
84         */
85        public static String getAccessText(int access) {
86                switch(access) {
87                        case IApiAccess.NORMAL: return "NORMAL"; //$NON-NLS-1$
88                        case IApiAccess.FRIEND: return "FRIEND"; //$NON-NLS-1$
89                }
90                return "<UNKNOWN ACCESS LEVEL>"; //$NON-NLS-1$
91        }
92}

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