Record Class ConstrainedEnumSubset
java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.support.ConstrainedEnumSubset
- Record Components:
names- the subset's value names, in declaration orderbaseOrdinals- the base enum ordinal of each name (same index)
THE members of a constrained enumeration (
RedSuit as CardSuit constrain as "Hearts" or "Diamonds"):
the base enum's values, in declaration order, whose name satisfies the constraint - each with its BASE
ordinal. Use this wherever a constrained enum must answer over its own subset rather than delegate to the
base enum (iteration, first #<, last #>); never re-derive the filter.
The constraint literals are the value names, so each name is evaluated as a String subject. When the constraint cannot be modelled at compile time, every base value is kept rather than silently yielding nothing.
-
Constructor Summary
ConstructorsConstructorDescriptionConstrainedEnumSubset(List<String> names, List<Integer> baseOrdinals) Creates an instance of aConstrainedEnumSubsetrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebaseOrdinalsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty()names()Returns the value of thenamesrecord component.static ConstrainedEnumSubsetof(AggregateSymbol constrainedType, IAggregateSymbol baseEnum) The subset ofbaseEnumadmitted byconstrainedType's constraint.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ConstrainedEnumSubset
-
-
Method Details
-
of
The subset ofbaseEnumadmitted byconstrainedType's constraint. -
isEmpty
public boolean isEmpty() -
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). -
names
-
baseOrdinals
Returns the value of thebaseOrdinalsrecord component.- Returns:
- the value of the
baseOrdinalsrecord component
-