Package net.hydromatic.morel.type
Class RecordType
java.lang.Object
net.hydromatic.morel.type.BaseType
net.hydromatic.morel.type.RecordType
- All Implemented Interfaces:
RecordLikeType,Type
- Direct Known Subclasses:
ProgressiveRecordType
Record type.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.collect.Ordering<String> Ordering that compares integer values numerically, string values lexicographically, and integer values before string values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(TypeVisitor<R> typeVisitor) Returns a map of the field types, keyed by field names.argType(int i) Returns the type of theith field, or throws.static intcompareNames(String o1, String o2) Helper forORDERING.copy(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.key()Description of the type, e.gCreates a constant map, sorted byORDERING.static <V> NavigableMap<String, V> Creates a mutable map, sorted byORDERING.private static intParses a string that contains an integer value; returnsInteger.MAX_VALUEif 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.booleanspecializes(Type type) Whether this type is the same as, or a specialization of, a given type.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.hydromatic.morel.type.RecordLikeType
argNames, argTypes, asTypedValueMethods inherited from interface net.hydromatic.morel.type.Type
arg, canCallArgOf, isCollection, isFinite, isProgressive, moniker, op, substitute, unifyWith
-
Field Details
-
argNameTypes
-
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
-
RecordType
-
-
Method Details
-
argNameTypes
Description copied from interface:RecordLikeTypeReturns a map of the field types, keyed by field names.- Specified by:
argNameTypesin interfaceRecordLikeType
-
argType
Description copied from interface:RecordLikeTypeReturns the type of theith field, or throws.- Specified by:
argTypein interfaceRecordLikeType
-
accept
-
key
Description copied from interface:TypeDescription of the type, e.g. "int", "int -> int", "NONE | SOME of 'a". -
copy
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. -
specializes
Description copied from interface:TypeWhether this type is the same as, or a specialization of, a given type.For example,
boolspecializesbooland'abut does not specializeintor('a, 'b).- Specified by:
specializesin interfaceType
-
map
Creates a constant map, sorted byORDERING. -
mutableMap
Creates a mutable map, sorted byORDERING. -
compareNames
Helper forORDERING. -
parseInt
Parses a string that contains an integer value; returnsInteger.MAX_VALUEif 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.
-