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;
 
  14  * The name environment provides a callback API that the compiler can use to
 
  15  * look up types, compilation units, and packages in the current environment.
 
  16  * The name environment is passed to the compiler on creation.
 
  18 public interface INameEnvironment {
 
  20          * Find a type with the given compound name. Answer the binary form of the
 
  21          * type if it is known to be consistent. Otherwise, answer the compilation
 
  22          * unit which defines the type or null if the type does not exist. Types in
 
  23          * the default package are specified as {{typeName}}.
 
  25          * It is unknown whether the package containing the type actually exists.
 
  27          * NOTE: This method can be used to find a member type using its internal
 
  28          * name A$B, but the source file for A is answered if the binary file is
 
  32         NameEnvironmentAnswer findType(char[][] compoundTypeName);
 
  35          * Find a type named <typeName> in the package <packageName>. Answer the
 
  36          * binary form of the type if it is known to be consistent. Otherwise,
 
  37          * answer the compilation unit which defines the type or null if the type
 
  38          * does not exist. The default package is indicated by char[0][].
 
  40          * It is known that the package containing the type exists.
 
  42          * NOTE: This method can be used to find a member type using its internal
 
  43          * name A$B, but the source file for A is answered if the binary file is
 
  47         NameEnvironmentAnswer findType(char[] typeName, char[][] packageName);
 
  50          * Answer whether packageName is the name of a known subpackage inside the
 
  51          * package parentPackageName. A top level package is found relative to null.
 
  52          * The default package is always assumed to exist.
 
  54          * For example: isPackage({{java}, {awt}}, {event}); isPackage(null,
 
  58         boolean isPackage(char[][] parentPackageName, char[] packageName);
 
  61          * This method cleans the environment uo. It is responsible for releasing
 
  62          * the memory and freeing resources. Passed that point, the name environment
 
  63          * is no longer usable.
 
  65          * A name environment can have a long life cycle, therefore it is the
 
  66          * responsibility of the code which created it to decide when it is a good
 
  67          * time to clean it up.