Updating syntax.xml to attempt fix issues reported in ticket #761
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / env / NameEnvironmentAnswer.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 public class NameEnvironmentAnswer {
14
15         // only one of the three can be set
16         IBinaryType binaryType;
17
18         ICompilationUnit compilationUnit;
19
20         ISourceType[] sourceTypes;
21
22         public NameEnvironmentAnswer(IBinaryType binaryType) {
23                 this.binaryType = binaryType;
24         }
25
26         public NameEnvironmentAnswer(ICompilationUnit compilationUnit) {
27                 this.compilationUnit = compilationUnit;
28         }
29
30         public NameEnvironmentAnswer(ISourceType[] sourceTypes) {
31                 this.sourceTypes = sourceTypes;
32         }
33
34         /**
35          * Answer the resolved binary form for the type or null if the receiver
36          * represents a compilation unit or source type.
37          */
38         public IBinaryType getBinaryType() {
39                 return binaryType;
40         }
41
42         /**
43          * Answer the compilation unit or null if the receiver represents a binary
44          * or source type.
45          */
46         public ICompilationUnit getCompilationUnit() {
47                 return compilationUnit;
48         }
49
50         /**
51          * Answer the unresolved source forms for the type or null if the receiver
52          * represents a compilation unit or binary type.
53          * 
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.
57          */
58         public ISourceType[] getSourceTypes() {
59                 return sourceTypes;
60         }
61
62         /**
63          * Answer whether the receiver contains the resolved binary form of the
64          * type.
65          */
66         public boolean isBinaryType() {
67                 return binaryType != null;
68         }
69
70         /**
71          * Answer whether the receiver contains the compilation unit which defines
72          * the type.
73          */
74         public boolean isCompilationUnit() {
75                 return compilationUnit != null;
76         }
77
78         /**
79          * Answer whether the receiver contains the unresolved source form of the
80          * type.
81          */
82         public boolean isSourceType() {
83                 return sourceTypes != null;
84         }
85 }