Package net.hydromatic.morel.type
Enum PrimitiveType
- java.lang.Object
-
- java.lang.Enum<PrimitiveType>
-
- net.hydromatic.morel.type.PrimitiveType
-
- All Implemented Interfaces:
Serializable,Comparable<PrimitiveType>,RecordLikeType,Type
public enum PrimitiveType extends Enum<PrimitiveType> implements RecordLikeType
Primitive type.
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePrimitiveType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Raccept(TypeVisitor<R> typeVisitor)SortedMap<String,Type>argNameTypes()TypeargType(int i)Returns the type of theith field, or throws.PrimitiveTypecopy(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.Type.Keykey()Description of the type, e.g.Opop()Type operator.StringtoString()static PrimitiveTypevalueOf(String name)Returns the enum constant of this type with the specified name.static PrimitiveType[]values()Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
-
Methods inherited from interface net.hydromatic.morel.type.Type
moniker, substitute
-
-
-
-
Enum Constant Detail
-
BOOL
public static final PrimitiveType BOOL
-
CHAR
public static final PrimitiveType CHAR
-
INT
public static final PrimitiveType INT
-
REAL
public static final PrimitiveType REAL
-
STRING
public static final PrimitiveType STRING
-
UNIT
public static final PrimitiveType UNIT
-
-
Field Detail
-
moniker
public final String moniker
The name in the language, e.g.bool.
-
-
Method Detail
-
values
public static PrimitiveType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PrimitiveType c : PrimitiveType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PrimitiveType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
toString
public String toString()
- Overrides:
toStringin classEnum<PrimitiveType>
-
key
public Type.Key key()
Description copied from interface:TypeDescription of the type, e.g. "int", "int -> int", "NONE | SOME of 'a".
-
accept
public <R> R accept(TypeVisitor<R> typeVisitor)
-
copy
public PrimitiveType 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.
-
argNameTypes
public SortedMap<String,Type> argNameTypes()
- Specified by:
argNameTypesin interfaceRecordLikeType
-
argType
public Type argType(int i)
Description copied from interface:RecordLikeTypeReturns the type of theith field, or throws.- Specified by:
argTypein interfaceRecordLikeType
-
-