Class TupleType

java.lang.Object
net.hydromatic.morel.type.BaseType
net.hydromatic.morel.type.TupleType
All Implemented Interfaces:
RecordLikeType, Type

public class TupleType extends BaseType implements RecordLikeType
The type of a tuple value.
  • Field Details

    • INT_STRINGS

      private static final String[] INT_STRINGS
    • argTypes

      public final List<Type> argTypes
  • Constructor Details

    • TupleType

      TupleType(List<? extends Type> argTypes)
  • Method Details

    • argNameTypes

      public SortedMap<String,Type> argNameTypes()
      Specified by:
      argNameTypes in interface RecordLikeType
    • argType

      public Type argType(int i)
      Description copied from interface: RecordLikeType
      Returns the type of the ith field, or throws.
      Specified by:
      argType in interface RecordLikeType
    • accept

      public <R> R accept(TypeVisitor<R> typeVisitor)
      Specified by:
      accept in interface Type
    • key

      public Type.Key key()
      Description copied from interface: Type
      Description of the type, e.g. "int", "int -> int", "NONE | SOME of 'a".
      Specified by:
      key in interface Type
    • copy

      public TupleType copy(TypeSystem typeSystem, UnaryOperator<Type> transform)
      Description copied from interface: Type
      Copies this type, applying a given transform to component types, and returning the original type if the component types are unchanged.
      Specified by:
      copy in interface Type
    • str

      private static String str(int i)
      Converts an integer to its string representation, using a cached value if possible.
    • ordinalNames

      public static List<String> ordinalNames(int size)
      Returns a list of strings ["1", ..., "size"].
    • recordMap

      static <E> com.google.common.collect.ImmutableSortedMap<String,E> recordMap(List<? extends E> argTypes)
      Given a list of types [t1, t2, ..., tn] returns a sorted map ["1" : t1, "2" : t2, ... "n" : tn].
    • toArgNameTypeKeys

      static com.google.common.collect.ImmutableSortedMap<String,Type.Key> toArgNameTypeKeys(List<? extends Type> argTypes)
      Given a list of types [t1, t2, ..., tn] returns a sorted map ["1" : t1.key, "2" : t2.key, ... "n" : tn.key].