Record Class EnumIteratorImplDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.data.EnumIteratorImplDetails
- Record Components:
enumTypeName- Fully qualified name of the iterated type (base or constrained enum)superTypeName- Fully qualified name of the parameterized Iterator type to extendenumValues- Value names to yield (all values for a base enum; the constrained SUBSET otherwise)baseEnumTypeName- Base enum FQN whenenumTypeNameis a CONSTRAINED enum; null for a base enumbaseOrdinals- For a constrained enum, the base ordinal of each value inenumValues(parallel list); empty for a base enum (index is the ordinal)resultVariable- Variable name to store the iterator instancedebugInfo- Debug information for source mapping
public record EnumIteratorImplDetails(String enumTypeName, String superTypeName, List<String> enumValues, String baseEnumTypeName, List<Integer> baseOrdinals, String resultVariable, DebugInfo debugInfo)
extends Record
Details for the ENUM_ITERATOR_IMPL IR instruction.
Contains all information needed by backends to generate an efficient iterator implementation for an enumeration type.
Two shapes:
- Base enum (via
forBaseEnum(String, String, List, String, DebugInfo)): each element is an instance ofenumTypeNameconstructed with_ordinal= its index and_name= the value name. - Constrained enum (via
forConstrainedEnum(String, String, List, String, List, String, DebugInfo)):enumTypeNameis the constrained type (e.g.module::RedSuit) andbaseEnumTypeNameis the base it wraps (e.g.module::CardSuit). Each element is a base value (name + its base ordinal frombaseOrdinals) WRAPPED in the constrained type via its(baseEnum)constructor, so iteration yields the constrained SUBSET as constrained instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebaseEnumTypeNamerecord component.Returns the value of thebaseOrdinalsrecord component.Returns the value of thedebugInforecord component.Returns the value of theenumTypeNamerecord component.intGet the number of enum values.Returns the value of theenumValuesrecord component.final booleanIndicates whether some other object is "equal to" this one.static EnumIteratorImplDetailsforBaseEnum(String enumTypeName, String superTypeName, List<String> enumValues, String resultVariable, DebugInfo debugInfo) Details for a base enumeration (each value is a freshenumTypeNameinstance, ordinal = index).static EnumIteratorImplDetailsforConstrainedEnum(String enumTypeName, String superTypeName, List<String> enumValues, String baseEnumTypeName, List<Integer> baseOrdinals, String resultVariable, DebugInfo debugInfo) Details for a constrained enumeration: yield theenumValuesSUBSET (with theirbaseOrdinals) ofbaseEnumTypeName, each WRAPPED inenumTypeNamevia its(baseEnum)constructor.booleanCheck if there are any enum values.final inthashCode()Returns a hash code value for this object.booleanTrue when this iterates a constrained enum (each yielded value is wrapped inenumTypeName).Returns the value of theresultVariablerecord component.Returns the value of thesuperTypeNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EnumIteratorImplDetails
-
-
Method Details
-
forBaseEnum
-
forConstrainedEnum
public static EnumIteratorImplDetails forConstrainedEnum(String enumTypeName, String superTypeName, List<String> enumValues, String baseEnumTypeName, List<Integer> baseOrdinals, String resultVariable, DebugInfo debugInfo) Details for a constrained enumeration: yield theenumValuesSUBSET (with theirbaseOrdinals) ofbaseEnumTypeName, each WRAPPED inenumTypeNamevia its(baseEnum)constructor. -
isConstrainedEnum
public boolean isConstrainedEnum()True when this iterates a constrained enum (each yielded value is wrapped inenumTypeName). -
enumValueCount
public int enumValueCount()Get the number of enum values. -
hasEnumValues
public boolean hasEnumValues()Check if there are any enum values. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
enumTypeName
Returns the value of theenumTypeNamerecord component.- Returns:
- the value of the
enumTypeNamerecord component
-
superTypeName
Returns the value of thesuperTypeNamerecord component.- Returns:
- the value of the
superTypeNamerecord component
-
enumValues
Returns the value of theenumValuesrecord component.- Returns:
- the value of the
enumValuesrecord component
-
baseEnumTypeName
Returns the value of thebaseEnumTypeNamerecord component.- Returns:
- the value of the
baseEnumTypeNamerecord component
-
baseOrdinals
Returns the value of thebaseOrdinalsrecord component.- Returns:
- the value of the
baseOrdinalsrecord component
-
resultVariable
Returns the value of theresultVariablerecord component.- Returns:
- the value of the
resultVariablerecord component
-
debugInfo
-