com.veromodo.tempo.sem.type
Class TypeTuple

java.lang.Object
  extended by com.veromodo.tempo.sem.type.Type
      extended by com.veromodo.tempo.sem.type.TypeTuple
All Implemented Interfaces:
java.lang.Comparable<Type>

public class TypeTuple
extends Type

An ordered and named set of types. Names are optional, but often provide useful information on the source of the type. TypeTuple is used for two purposes in Tempo. I) domains of function types II) implementation of the Tempo Tuple Types defined by type Tuple shorthand For example, the follow syntax fragments all produce tuple types let f(x:Int, y:Nat) = x*y __+__ : Int,Int -> Int myType tuple [one:Int, two:Int]


Nested Class Summary
 
Nested classes/interfaces inherited from class com.veromodo.tempo.sem.type.Type
Type.Order, Type.TypeKind
 
Field Summary
 
Fields inherited from class com.veromodo.tempo.sem.type.Type
_name, DEFAULT_NAME
 
Constructor Summary
TypeTuple()
           
TypeTuple(java.lang.String name)
           
TypeTuple(TypeTuple t2)
           
TypeTuple(Type a, Type b)
           
 
Method Summary
 boolean accept(Type t)
          Determines if Type t is a subtype of this.
 TypeTuple add(Type t, java.lang.String n)
           
 Type.Order compare(Type t)
          Determines how Type t is realted to this.
 Type.Order compare(Type t, boolean named)
           
 TypeTuple downCastTuple()
           
 int getArity()
           
 Type getField(int x)
           
 java.util.Vector<Type> getFields()
           
 java.util.Vector<java.lang.String> getNames()
           
 int hashCode()
           
 boolean is(Type.TypeKind kind)
          Determines if the currently instance is of given TypeKind.
 TypeTuple pushDownGenericWrappers()
          Takes a tuple of the form TypeGeneric([T1,T2,T3]) -> [TypeGeneric(T1),TypeGeneric(T2),TypeGeneric(T3)] This transformation is very helpfull when comparing multiple funtion domains
 Type resolve()
          Replaces any bound type parameters with thier bound types.
 Type select(java.lang.String with)
          Create a function type -> FT which correspond to the application of the dereference operator 'with'.
 java.lang.String toString()
           
 void visit(TypeVisitor v)
           
 
Methods inherited from class com.veromodo.tempo.sem.type.Type
acceptable, compareTo, constructedWith, downCastArray, downCastAugmentedReal, downCastAutomaton, downCastBasicAutomaton, downCastBool, downCastChar, downCastCompositeAutomaton, downCastConstructor, downCastDiscreteReal, downCastEnum, downCastEnumValue, downCastFloat, downCastFunction, downCastFunctional, downCastFunctionalGeneric, downCastGeneric, downCastInstance, downCastInt, downCastInt32, downCastList, downCastMap, downCastMeta, downCastNat, downCastNumeric, downCastParameter, downCastReal, downCastSum, downCastVoid, equals, equals, getName, isArray, isAugmentedReal, isAutomaton, isBasicAutomaton, isBool, isChar, isCompositeAutomaton, isConstructor, isDiscreteReal, isEnum, isEnumValue, isEqualTo, isError, isFloat, isFun, isFunctional, isFunctionalGeneric, isGeneric, isId, isIndexed, isInstance, isInt, isInt32, isList, isMap, isMeta, isNat, isNumeric, isParameter, isReal, isSum, isTuple, isVariable, isVoid, lub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TypeTuple

public TypeTuple()

TypeTuple

public TypeTuple(java.lang.String name)

TypeTuple

public TypeTuple(TypeTuple t2)

TypeTuple

public TypeTuple(Type a,
                 Type b)
Method Detail

getArity

public int getArity()

getField

public Type getField(int x)

getFields

public java.util.Vector<Type> getFields()

pushDownGenericWrappers

public TypeTuple pushDownGenericWrappers()
Takes a tuple of the form TypeGeneric([T1,T2,T3]) -> [TypeGeneric(T1),TypeGeneric(T2),TypeGeneric(T3)] This transformation is very helpfull when comparing multiple funtion domains

Returns:
transformed so that all parametric fields have thier own TypeGeneric

downCastTuple

public TypeTuple downCastTuple()
Overrides:
downCastTuple in class Type

select

public Type select(java.lang.String with)
Create a function type -> FT which correspond to the application of the dereference operator 'with'. 'with' must be a field of the tuple and the dereference operator is seen as a curried function from the tuple type to the field type. returns If no field named 'with' exist, no function type is returned (i.e., return null)

Overrides:
select in class Type
Parameters:
with - the parameter to select
Returns:
a TypeFunction this ? TypeOf(with)

add

public TypeTuple add(Type t,
                     java.lang.String n)

is

public boolean is(Type.TypeKind kind)
Description copied from class: Type
Determines if the currently instance is of given TypeKind.

Overrides:
is in class Type
Parameters:
kind - the type of class to compare to
Returns:
true if this is of given TypeKind

toString

public java.lang.String toString()
Overrides:
toString in class Type

resolve

public Type resolve()
Description copied from class: Type
Replaces any bound type parameters with thier bound types. If all parameters are bound, the resulting type is not generic. If no parameters are bounf, the resulting type is this.

Overrides:
resolve in class Type
Returns:
a resolved type

compare

public Type.Order compare(Type t)
Description copied from class: Type
Determines how Type t is realted to this.

Specified by:
compare in class Type
Parameters:
t - to compare to this
Returns:

compare

public Type.Order compare(Type t,
                          boolean named)

visit

public void visit(TypeVisitor v)
Specified by:
visit in class Type

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

accept

public boolean accept(Type t)
Description copied from class: Type
Determines if Type t is a subtype of this. a.k.a. can t be assigned into this

Overrides:
accept in class Type
Parameters:
t - to compare to this
Returns:
true if t is a subtype of this

getNames

public java.util.Vector<java.lang.String> getNames()