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

nameclass, %method, %block, %line, %
ApiAnnotations.java100% (1/1)50%  (3/6)37%  (26/71)33%  (6/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ApiAnnotations100% (1/1)50%  (3/6)37%  (26/71)33%  (6/18)
equals (Object): boolean 0%   (0/1)0%   (0/17)0%   (0/5)
hashCode (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/25)0%   (0/6)
ApiAnnotations (int, int): void 100% (1/1)100% (12/12)100% (4/4)
getRestrictions (): int 100% (1/1)100% (7/7)100% (1/1)
getVisibility (): int 100% (1/1)100% (7/7)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 2007, 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.IApiAnnotations;
14import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
15import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
16 
17/**
18 * Base implementation of the {@linkplain IApiAnnotations} interface
19 * 
20 * @since 1.0.0
21 */
22public class ApiAnnotations implements IApiAnnotations {
23 
24        public static final int VISIBILITY_MASK = 0x000F;
25        public static final int RESTRICTIONS_MASK = 0x01F0;
26        public static final int OFFSET_VISIBILITY = 0;
27        public static final int OFFSET_RESTRICTIONS = 4;
28        private int bits;
29        
30        public ApiAnnotations(int visibility, int restrictions) {
31                this.bits = (visibility << OFFSET_VISIBILITY)
32                        | (restrictions << OFFSET_RESTRICTIONS);
33        }
34        
35        /* (non-Javadoc)
36         * @see org.eclipse.pde.api.tools.model.IApiAnnotations#getRestrictions()
37         */
38        public int getRestrictions() {
39                return (this.bits & RESTRICTIONS_MASK) >> OFFSET_RESTRICTIONS;
40        }
41        
42        /* (non-Javadoc)
43         * @see org.eclipse.pde.api.tools.model.IApiAnnotations#getVisibility()
44         */
45        public int getVisibility() {
46                return (this.bits & VISIBILITY_MASK) >> OFFSET_VISIBILITY;
47        }
48 
49        /* (non-Javadoc)
50         * @see java.lang.Object#toString()
51         */
52        public String toString() {
53                StringBuffer buffer = new StringBuffer();
54                buffer.append(VisibilityModifiers.getVisibilityName(getVisibility()));
55                buffer.append(" / "); //$NON-NLS-1$
56                int restrictions = getRestrictions();
57                buffer.append(RestrictionModifiers.getRestrictionText(restrictions));
58                return buffer.toString();
59        }
60 
61        /* (non-Javadoc)
62         * @see java.lang.Object#equals(java.lang.Object)
63         */
64        public boolean equals(Object obj) {
65                if (obj instanceof ApiAnnotations) {
66                        ApiAnnotations desc = (ApiAnnotations) obj;
67                        return
68                                this.bits == desc.bits;
69                }
70                return false;
71        }
72 
73        /* (non-Javadoc)
74         * @see java.lang.Object#hashCode()
75         */
76        public int hashCode() {
77                return this.bits;
78        }
79        
80}

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