|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.data.type.TypeLattice
public class TypeLattice
Type hierarchy for token classes. Note that all public methods are static and synchronized. There is exactly one instance of the type lattice. Although the type lattice is constructed once and then typically does not change during execution, the methods need to be synchronized because there are various data structures used to cache results that are expensive to compute. These data structures do change during execution. Multiple threads may be accessing the type lattice simultaneously and modifying these data structures. To ensure thread safety, the methods need to be synchronized.
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) |
Nested Class Summary | |
---|---|
private static class |
TypeLattice.TheTypeLattice
|
Field Summary | |
---|---|
private static int[][] |
_compareCache
The result cache for parts of the type lattice. |
private static TypeLattice.TheTypeLattice |
_lattice
The infinite type lattice. |
Constructor Summary | |
---|---|
TypeLattice()
|
Method Summary | |
---|---|
private static int |
_getCachedTypeComparisonResult(int index1,
int index2)
Return the result for the types that have the given two indexes as hashes. |
private static void |
_setCachedTypeComparisonResult(int index1,
int index2,
int value)
Set the result for the types that have the given two indexes as hashes. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static TypeLattice.TheTypeLattice _lattice
private static int[][] _compareCache
Constructor Detail |
---|
public TypeLattice()
Method Detail |
---|
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()
public static Type leastUpperBound(Type type1, Type type2)
type1
- The first given type.type2
- The second given type.
private static final int _getCachedTypeComparisonResult(int index1, int index2)
private static final void _setCachedTypeComparisonResult(int index1, int index2, int value)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |