Class RecordType

java.lang.Object
net.hydromatic.morel.type.BaseType
net.hydromatic.morel.type.RecordType
All Implemented Interfaces:
RecordLikeType, Type
Direct Known Subclasses:
ProgressiveRecordType

public class RecordType extends BaseType implements RecordLikeType
Record type.
  • Field Details

    • argNameTypes

      public final SortedMap<String,Type> argNameTypes
    • ORDERING

      public static final com.google.common.collect.Ordering<String> ORDERING
      Ordering that compares integer values numerically, string values lexicographically, and integer values before string values.

      Thus: 2, 22, 202, a, a2, a202, a22.

  • Constructor Details

  • 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 RecordType 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
    • compareNames

      public static int compareNames(String o1, String o2)
      Helper for ORDERING.
    • parseInt

      private static int parseInt(String s)
      Parses a string that contains an integer value; returns Integer.MAX_VALUE if the string does not contain an integer, or if the value is less than zero, or if the value is greater than or equal to 1 billion.

      This approach is much faster for our purposes than Integer.parseInt(String), which has to create and throw an exception if the value is not an integer.