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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractApiTypeRoot.java]

nameclass, %method, %block, %line, %
AbstractApiTypeRoot.java100% (1/1)100% (3/3)100% (52/52)100% (15/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractApiTypeRoot100% (1/1)100% (3/3)100% (52/52)100% (15/15)
AbstractApiTypeRoot (IApiElement, String): void 100% (1/1)100% (6/6)100% (2/2)
getApiComponent (): IApiComponent 100% (1/1)100% (5/5)100% (1/1)
getStructure (): IApiType 100% (1/1)100% (41/41)100% (12/12)

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.model;
12 
13import org.eclipse.core.runtime.CoreException;
14import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
15import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
16import org.eclipse.pde.api.tools.internal.provisional.model.IApiElement;
17import org.eclipse.pde.api.tools.internal.provisional.model.IApiType;
18import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot;
19 
20/**
21 * Common implementation for {@link IApiTypeRoot}
22 * 
23 * @since 1.0.0
24 */
25public abstract class AbstractApiTypeRoot extends ApiElement implements IApiTypeRoot {
26 
27        /**
28         * Constructor
29         * @param parent the parent {@link IApiElement} or <code>null</code> if none
30         * @param name the name of the type root
31         */
32        protected AbstractApiTypeRoot(IApiElement parent, String name) {
33                super(parent, IApiElement.API_TYPE_ROOT, name);
34        }
35        
36        /* (non-Javadoc)
37         * @see org.eclipse.pde.api.tools.internal.provisional.IApiTypeRoot#getContents()
38         */
39        public abstract byte[] getContents() throws CoreException;
40        
41        /* (non-Javadoc)
42         * @see org.eclipse.pde.api.tools.internal.provisional.IApiTypeRoot#getStructure()
43         */
44        public IApiType getStructure() throws CoreException {
45                ApiModelCache cache = ApiModelCache.getCache();
46                IApiComponent comp = getApiComponent();
47                IApiType type = null;
48                if(comp != null) {
49                        IApiBaseline baseline = comp.getBaseline();
50                        type = (IApiType) cache.getElementInfo(baseline.getName(), comp.getId(), this.getTypeName(), IApiElement.TYPE);
51                }
52                if(type == null) {
53                        type = TypeStructureBuilder.buildTypeStructure(getContents(), getApiComponent(), this);
54                        if(type == null) {
55                                return null;
56                        }
57                        cache.cacheElementInfo(type);
58                }
59                return type;
60        }
61        
62        /**
63         * @see org.eclipse.pde.api.tools.internal.provisional.IApiTypeRoot#getApiComponent()
64         */
65        public IApiComponent getApiComponent() {
66                return (IApiComponent) getAncestor(IApiElement.COMPONENT);
67        }
68}

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