A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / env / INameEnvironment.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.env;
12
13 /**
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.
17  */
18 public interface INameEnvironment {
19         /**
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}}.
24          * 
25          * It is unknown whether the package containing the type actually exists.
26          * 
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
29          * inconsistent.
30          */
31
32         NameEnvironmentAnswer findType(char[][] compoundTypeName);
33
34         /**
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][].
39          * 
40          * It is known that the package containing the type exists.
41          * 
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
44          * inconsistent.
45          */
46
47         NameEnvironmentAnswer findType(char[] typeName, char[][] packageName);
48
49         /**
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.
53          * 
54          * For example: isPackage({{java}, {awt}}, {event}); isPackage(null,
55          * {java});
56          */
57
58         boolean isPackage(char[][] parentPackageName, char[] packageName);
59
60         /**
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.
64          * 
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.
68          */
69         void cleanup();
70
71 }