make sure that the VariableHover for the debugPlugin is the first to show
[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         ICompilationUnit compilationUnit;
18         ISourceType[] sourceTypes;
19         
20         public NameEnvironmentAnswer(IBinaryType binaryType) {
21                 this.binaryType = binaryType;
22         }
23
24         public NameEnvironmentAnswer(ICompilationUnit compilationUnit) {
25                 this.compilationUnit = compilationUnit;
26         }
27
28         public NameEnvironmentAnswer(ISourceType[] sourceTypes) {
29                 this.sourceTypes = sourceTypes;
30         }
31
32         /**
33          * Answer the resolved binary form for the type or null if the
34          * receiver represents a compilation unit or source type.
35          */
36         public IBinaryType getBinaryType() {
37                 return binaryType;
38         }
39
40         /**
41          * Answer the compilation unit or null if the
42          * receiver represents a binary or source type.
43          */
44         public ICompilationUnit getCompilationUnit() {
45                 return compilationUnit;
46         }
47
48         /**
49          * Answer the unresolved source forms for the type or null if the
50          * receiver represents a compilation unit or binary type.
51          * 
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.
54          */
55         public ISourceType[] getSourceTypes() {
56                 return sourceTypes;
57         }
58
59         /**
60          * Answer whether the receiver contains the resolved binary form of the type.
61          */
62         public boolean isBinaryType() {
63                 return binaryType != null;
64         }
65
66         /**
67          * Answer whether the receiver contains the compilation unit which defines the type.
68          */
69         public boolean isCompilationUnit() {
70                 return compilationUnit != null;
71         }
72
73         /**
74          * Answer whether the receiver contains the unresolved source form of the type.
75          */
76         public boolean isSourceType() {
77                 return sourceTypes != null;
78         }
79 }