Package net.hydromatic.morel.type
Class DataType
- java.lang.Object
-
- net.hydromatic.morel.type.BaseType
-
- net.hydromatic.morel.type.ParameterizedType
-
- net.hydromatic.morel.type.DataType
-
- Direct Known Subclasses:
TemporaryType
public class DataType extends ParameterizedType
Algebraic type.
-
-
Field Summary
Fields Modifier and Type Field Description private Type.KeykeySortedMap<String,Type>typeConstructors-
Fields inherited from class net.hydromatic.morel.type.ParameterizedType
moniker, name, parameterTypes
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)DataType(String name, Type.Key key, List<? extends Type> parameterTypes, SortedMap<String,Type> typeConstructors)Creates a DataType.protectedDataType(Op op, String name, Type.Key key, List<? extends Type> parameterTypes, SortedMap<String,Type> typeConstructors)Called only from DataType and TemporaryType constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Raccept(TypeVisitor<R> typeVisitor)DataTypecopy(TypeSystem typeSystem, UnaryOperator<Type> transform)Copies this type, applying a given transform to component types, and returning the original type if the component types are unchanged.Keys.DataTypeDefdef()Type.Keykey()Description of the type, e.g.Typesubstitute(TypeSystem typeSystem, List<? extends Type> types, TypeSystem.Transaction transaction)Returns a copy of this type, specialized by substituting type parameters.protected Typesubstitute2(TypeSystem typeSystem, List<? extends Type> types, TypeSystem.Transaction transaction)Second part of the implementation ofsubstitute(TypeSystem, List, TypeSystem.Transaction), called if there is not already a type of the given description.-
Methods inherited from class net.hydromatic.morel.type.ParameterizedType
computeMoniker, moniker, name, toString
-
-
-
-
Constructor Detail
-
DataType
DataType(String name, Type.Key key, List<? extends Type> parameterTypes, SortedMap<String,Type> typeConstructors)
Creates a DataType.Called only from
TypeSystem.dataTypes(List).If the
typeSystemargument is specified, canonizes the types inside type-constructors. This also allows temporary types (necessary while creating self-referential data types) to be replaced with real DataType instances.During replacement, if a type matches
placeholderTypeit is replaced withthis. This allows cyclic graphs to be copied.
-
-
Method Detail
-
key
public Type.Key key()
Description copied from interface:TypeDescription of the type, e.g. "int", "int -> int", "NONE | SOME of 'a".
-
def
public Keys.DataTypeDef def()
-
accept
public <R> R accept(TypeVisitor<R> typeVisitor)
-
copy
public DataType copy(TypeSystem typeSystem, UnaryOperator<Type> transform)
Description copied from interface:TypeCopies this type, applying a given transform to component types, and returning the original type if the component types are unchanged.
-
substitute
public Type substitute(TypeSystem typeSystem, List<? extends Type> types, TypeSystem.Transaction transaction)
Description copied from interface:TypeReturns a copy of this type, specialized by substituting type parameters.
-
substitute2
protected Type substitute2(TypeSystem typeSystem, List<? extends Type> types, TypeSystem.Transaction transaction)
Second part of the implementation ofsubstitute(TypeSystem, List, TypeSystem.Transaction), called if there is not already a type of the given description.
-
-