com.veromodo.tempo.sem.type
Class RankType

java.lang.Object
  extended by com.veromodo.tempo.sem.type.TypeVisitor
      extended by com.veromodo.tempo.sem.type.RankType

public class RankType
extends TypeVisitor

measures the distance between two types T1, T2 T1 must be a subtype of T2

Author:
Carleton

Constructor Summary
RankType()
           
 
Method Summary
 void applyTypeAugmentedReal(TypeAugmentedReal n)
           
 void applyTypeAutomaton(TypeAutomaton n)
           
 void applyTypeBasicAutomaton(TypeBasicAutomaton n)
           
 void applyTypeBool(TypeBool n)
           
 void applyTypeChar(TypeChar n)
           
 void applyTypeCompositeAutomaton(TypeCompositeAutomaton n)
           
 void applyTypeConstructor(TypeConstructor n)
           
 void applyTypeDiscreteReal(TypeDiscreteReal n)
           
 void applyTypeEnum(TypeEnum n)
           
 void applyTypeEnumValue(TypeEnumValue n)
           
 void applyTypeError(TypeError n)
           
 void applyTypeFloat(TypeFloat n)
           
 void applyTypeFunction(TypeFunction n)
           
 void applyTypeFunctionalGeneric(TypeFunctionalGeneric n)
           
 void applyTypeGeneric(TypeGeneric n)
           
 void applyTypeId(TypeId n)
           
 void applyTypeInstance(TypeInstance n)
           
 void applyTypeInt(TypeInt n)
           
 void applyTypeInt32(TypeInt32 n)
           
 void applyTypeList(TypeList n)
           
 void applyTypeMap(TypeMap n)
           
 void applyTypeMatrix(TypeArray n)
           
 void applyTypeMeta(TypeMeta n)
           
 void applyTypeNat(TypeNat n)
           
 void applyTypeParameter(TypeParameter n)
           
 void applyTypeReal(TypeReal n)
           
 void applyTypeSum(TypeSum n)
           
 void applyTypeTuple(TypeTuple n)
           
 void applyTypeVariable(TypeVariable n)
           
 void applyTypeVoid(TypeVoid n)
           
 int rank(Type s, Type t)
          This method computes the distance between two types related through sub-typing
 
Methods inherited from class com.veromodo.tempo.sem.type.TypeVisitor
applyTypeFunctional, applyTypeIndexed, doIt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RankType

public RankType()
Method Detail

rank

public int rank(Type s,
                Type t)
This method computes the distance between two types related through sub-typing

Parameters:
s - The subtype
t - The supertype
Returns:
The 'distance' that separates the two types. Distance is to be interpreted as the number of uit type coercions that would be required to convert one type into the other. rank(T,T) == 0 rank(bool,int) == 1 rank(bool,real) == 2 rank(S,T) = defined inductively on the structure of S and T e.g. S=Tuple(S1,...Sn) AND T=Tuple(T1,...Tm) and n=m => rank(S,T) = sum(i in 1..n) rank(Si,Ti)

applyTypeNat

public void applyTypeNat(TypeNat n)
Overrides:
applyTypeNat in class TypeVisitor

applyTypeBool

public void applyTypeBool(TypeBool n)
Overrides:
applyTypeBool in class TypeVisitor

applyTypeError

public void applyTypeError(TypeError n)
Overrides:
applyTypeError in class TypeVisitor

applyTypeFloat

public void applyTypeFloat(TypeFloat n)
Overrides:
applyTypeFloat in class TypeVisitor

applyTypeDiscreteReal

public void applyTypeDiscreteReal(TypeDiscreteReal n)
Overrides:
applyTypeDiscreteReal in class TypeVisitor

applyTypeId

public void applyTypeId(TypeId n)
Overrides:
applyTypeId in class TypeVisitor

applyTypeInt

public void applyTypeInt(TypeInt n)
Overrides:
applyTypeInt in class TypeVisitor

applyTypeInt32

public void applyTypeInt32(TypeInt32 n)
Overrides:
applyTypeInt32 in class TypeVisitor

applyTypeVoid

public void applyTypeVoid(TypeVoid n)
Overrides:
applyTypeVoid in class TypeVisitor

applyTypeReal

public void applyTypeReal(TypeReal n)
Overrides:
applyTypeReal in class TypeVisitor

applyTypeAugmentedReal

public void applyTypeAugmentedReal(TypeAugmentedReal n)
Overrides:
applyTypeAugmentedReal in class TypeVisitor

applyTypeChar

public void applyTypeChar(TypeChar n)
Overrides:
applyTypeChar in class TypeVisitor

applyTypeMeta

public void applyTypeMeta(TypeMeta n)
Overrides:
applyTypeMeta in class TypeVisitor

applyTypeParameter

public void applyTypeParameter(TypeParameter n)
Overrides:
applyTypeParameter in class TypeVisitor

applyTypeList

public void applyTypeList(TypeList n)
Overrides:
applyTypeList in class TypeVisitor

applyTypeSum

public void applyTypeSum(TypeSum n)
Overrides:
applyTypeSum in class TypeVisitor

applyTypeTuple

public void applyTypeTuple(TypeTuple n)
Overrides:
applyTypeTuple in class TypeVisitor

applyTypeMatrix

public void applyTypeMatrix(TypeArray n)
Overrides:
applyTypeMatrix in class TypeVisitor

applyTypeMap

public void applyTypeMap(TypeMap n)
Overrides:
applyTypeMap in class TypeVisitor

applyTypeConstructor

public void applyTypeConstructor(TypeConstructor n)
Overrides:
applyTypeConstructor in class TypeVisitor

applyTypeFunction

public void applyTypeFunction(TypeFunction n)
Overrides:
applyTypeFunction in class TypeVisitor

applyTypeGeneric

public void applyTypeGeneric(TypeGeneric n)
Overrides:
applyTypeGeneric in class TypeVisitor

applyTypeFunctionalGeneric

public void applyTypeFunctionalGeneric(TypeFunctionalGeneric n)
Overrides:
applyTypeFunctionalGeneric in class TypeVisitor

applyTypeEnum

public void applyTypeEnum(TypeEnum n)
Overrides:
applyTypeEnum in class TypeVisitor

applyTypeEnumValue

public void applyTypeEnumValue(TypeEnumValue n)
Overrides:
applyTypeEnumValue in class TypeVisitor

applyTypeVariable

public void applyTypeVariable(TypeVariable n)
Overrides:
applyTypeVariable in class TypeVisitor

applyTypeAutomaton

public void applyTypeAutomaton(TypeAutomaton n)
Overrides:
applyTypeAutomaton in class TypeVisitor

applyTypeBasicAutomaton

public void applyTypeBasicAutomaton(TypeBasicAutomaton n)
Overrides:
applyTypeBasicAutomaton in class TypeVisitor

applyTypeCompositeAutomaton

public void applyTypeCompositeAutomaton(TypeCompositeAutomaton n)
Overrides:
applyTypeCompositeAutomaton in class TypeVisitor

applyTypeInstance

public void applyTypeInstance(TypeInstance n)
Overrides:
applyTypeInstance in class TypeVisitor