1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.env;
13 public class NameEnvironmentAnswer {
15 // only one of the three can be set
16 IBinaryType binaryType;
18 ICompilationUnit compilationUnit;
20 ISourceType[] sourceTypes;
22 public NameEnvironmentAnswer(IBinaryType binaryType) {
23 this.binaryType = binaryType;
26 public NameEnvironmentAnswer(ICompilationUnit compilationUnit) {
27 this.compilationUnit = compilationUnit;
30 public NameEnvironmentAnswer(ISourceType[] sourceTypes) {
31 this.sourceTypes = sourceTypes;
35 * Answer the resolved binary form for the type or null if the receiver
36 * represents a compilation unit or source type.
38 public IBinaryType getBinaryType() {
43 * Answer the compilation unit or null if the receiver represents a binary
46 public ICompilationUnit getCompilationUnit() {
47 return compilationUnit;
51 * Answer the unresolved source forms for the type or null if the receiver
52 * represents a compilation unit or binary type.
54 * Multiple source forms can be answered in case the originating compilation
55 * unit did contain several type at once. Then the first type is guaranteed
56 * to be the requested type.
58 public ISourceType[] getSourceTypes() {
63 * Answer whether the receiver contains the resolved binary form of the
66 public boolean isBinaryType() {
67 return binaryType != null;
71 * Answer whether the receiver contains the compilation unit which defines
74 public boolean isCompilationUnit() {
75 return compilationUnit != null;
79 * Answer whether the receiver contains the unresolved source form of the
82 public boolean isSourceType() {
83 return sourceTypes != null;