1 /*******************************************************************************
 
   2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
 
   3  * All rights reserved. This program and the accompanying materials 
 
   4  * are made available under the terms of the Common Public License v0.5 
 
   5  * which accompanies this distribution, and is available at
 
   6  * http://www.eclipse.org/legal/cpl-v05.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;
 
  17         ICompilationUnit compilationUnit;
 
  18         ISourceType[] sourceTypes;
 
  20         public NameEnvironmentAnswer(IBinaryType binaryType) {
 
  21                 this.binaryType = binaryType;
 
  24         public NameEnvironmentAnswer(ICompilationUnit compilationUnit) {
 
  25                 this.compilationUnit = compilationUnit;
 
  28         public NameEnvironmentAnswer(ISourceType[] sourceTypes) {
 
  29                 this.sourceTypes = sourceTypes;
 
  33          * Answer the resolved binary form for the type or null if the
 
  34          * receiver represents a compilation unit or source type.
 
  36         public IBinaryType getBinaryType() {
 
  41          * Answer the compilation unit or null if the
 
  42          * receiver represents a binary or source type.
 
  44         public ICompilationUnit getCompilationUnit() {
 
  45                 return compilationUnit;
 
  49          * Answer the unresolved source forms for the type or null if the
 
  50          * receiver represents a compilation unit or binary type.
 
  52          * Multiple source forms can be answered in case the originating compilation unit did contain
 
  53          * several type at once. Then the first type is guaranteed to be the requested type.
 
  55         public ISourceType[] getSourceTypes() {
 
  60          * Answer whether the receiver contains the resolved binary form of the type.
 
  62         public boolean isBinaryType() {
 
  63                 return binaryType != null;
 
  67          * Answer whether the receiver contains the compilation unit which defines the type.
 
  69         public boolean isCompilationUnit() {
 
  70                 return compilationUnit != null;
 
  74          * Answer whether the receiver contains the unresolved source form of the type.
 
  76         public boolean isSourceType() {
 
  77                 return sourceTypes != null;