ptolemy.data.type
Class TypeLattice

java.lang.Object
  extended byptolemy.data.type.TypeLattice

public class TypeLattice
extends java.lang.Object

Type hierarchy for token classes.

Since:
Ptolemy II 0.4
Version:
$Id: TypeLattice.java,v 1.56 2004/04/13 03:22:47 cxh Exp $
Author:
Yuhong Xiong, Steve Neuendorffer
See Also:
CPO
Accepted Rating:
Red
Proposed Rating:
Red (yuhong)

Constructor Summary
TypeLattice()
           
 
Method Summary
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
 

Constructor Detail

TypeLattice

public TypeLattice()
Method Detail

basicLattice

public static CPO basicLattice()
Return the an instance of CPO representing the basic type lattice.

Returns:
an instance of CPO.

compare

public static int compare(Token token1,
                          Token token2)
Compare the types of the two specified tokens in the type lattice. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the the type of the first argument is lower than, equal to, higher than, or incomparable with that of the second in the type hierarchy, respectively.

Parameters:
token1 - a Token.
token2 - a Token.
Returns:
An integer.

compare

public static int compare(Token token,
                          Type type)
Compare the types of the two specified tokens in the type lattice. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the the type of the first argument is lower than, equal to, higher than, or incomparable with that of the second in the type hierarchy, respectively.

Parameters:
token - a Token.
type - a Type.
Returns:
An integer.

compare

public static int compare(Type type,
                          Token token)
Compare the types of the two specified tokens in the type lattice. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the the type of the first argument is lower than, equal to, higher than, or incomparable with that of the second in the type hierarchy, respectively.

Parameters:
token - a Token.
type - a Type.
Returns:
An integer.

compare

public static int compare(Type type1,
                          Type type2)
Compare two types in the type lattice. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the first argument is lower than, equal to, higher than, or incomparable with the second argument in the type hierarchy, respectively.

Parameters:
type1 - an instance of Type.
type2 - an instance of Type.
Returns:
An integer.

lattice

public static CPO lattice()
Return the an instance of CPO representing the infinite type lattice.

Returns:
an instance of CPO.

leastUpperBound

public static Type leastUpperBound(Type type1,
                                   Type type2)
Return the least upper bound of the two given types.