public class TypeLattice
extends java.lang.Object
There is exactly one instance of the type lattice. It is constructed once and then does not change during execution. A concurrent hash table is used to cache type comparison results to optimize for frequently occurring type comparisons.
The Java Language Spec, 3rd ed. says:
"The integral types are byte, short, int, and long, whose values are 8-bit, 16-bit, 32-bit and 64-bit signed two's-complement integers, respectively, and char, whose values are 16-bit unsigned integers representing UTF-16 code units (3.1). The floating-point types are float, whose values include the 32-bit IEEE 754 floating-point numbers, and double, whose values include the 64-bit IEEE 754 floating-point numbers"Thus,
CPO
Red |
Red (yuhong) |
Constructor and Description |
---|
TypeLattice() |
Modifier and Type | Method and Description |
---|---|
static CPO |
basicLattice()
Return the an instance of CPO representing the basic type
lattice.
|
static int |
compare(Token token1,
Token token2)
Compare the types of the two specified tokens in the type lattice.
|
static int |
compare(Token token,
Type type)
Compare the types of the two specified tokens in the type lattice.
|
static int |
compare(Type type,
Token token)
Compare the types of the two specified tokens in the type lattice.
|
static int |
compare(Type type1,
Type type2)
Compare two types in the type lattice.
|
static CPO |
lattice()
Return the an instance of CPO representing the infinite type
lattice.
|
static Type |
leastUpperBound(Type type1,
Type type2)
Return the least upper bound of the two given types.
|
public static CPO basicLattice()
public static int compare(Token token1, Token token2)
token1
- a Token.token2
- a Token.public static int compare(Token token, Type type)
token
- a Token.type
- a Type.public static int compare(Type type, Token token)
token
- a Token.type
- a Type.public static int compare(Type type1, Type type2)
type1
- an instance of Type.type2
- an instance of Type.public static CPO lattice()