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.lookup;
13 public final class BaseTypeBinding extends TypeBinding {
14 public char[] simpleName;
16 private char[] constantPoolName;
18 BaseTypeBinding(int id, char[] name, char[] constantPoolName) {
19 this.tagBits |= IsBaseType;
21 this.simpleName = name;
22 this.constantPoolName = constantPoolName;
26 * Answer the receiver's constant pool name.
29 public char[] constantPoolName() {
30 return constantPoolName;
33 public PackageBinding getPackage() {
38 * Answer true if the receiver type can be assigned to the argument type
42 public final boolean isCompatibleWith(TypeBinding right) {
45 if (!right.isBaseType())
46 return this == NullBinding;
96 return (id == T_byte);
101 public static final boolean isNarrowing(int left, int right) {
102 // can "left" store a "right" using some narrowing conversion
103 // (is left smaller than right)
107 return right == T_boolean;
113 if (right == T_short)
124 if (right == T_float)
127 if (right == T_double)
134 public static final boolean isWidening(int left, int right) {
135 // can "left" store a "right" using some widening conversion
136 // (is left "bigger" than right)
140 return right == T_boolean;
142 return right == T_char;
144 if (right == T_double)
147 if (right == T_float)
158 if (right == T_short)
168 public char[] qualifiedSourceName() {
172 public char[] readableName() {
176 public char[] shortReadableName() {
180 public char[] sourceName() {
184 public String toString() {
185 return new String(constantPoolName) + " (id=" + id + ")"; //$NON-NLS-1$ //$NON-NLS-2$