Record Class ConditionCase
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.ConditionCase
public record ConditionCase(String caseScopeId, String caseType, List<IRInstr> guardUpdates, String bodyScopeId, String enumConstant, int enumOrdinal, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult)
extends Record
Record representing a single condition case within a CONTROL_FLOW_CHAIN.
Each condition case represents one evaluation path in the sequential chain: - Question operator: NULL_CHECK case - If statement: Boolean condition evaluation - Switch case: Equality or expression evaluation - Guard conditions: Combined assignment + condition evaluation
Contains complete evaluation instructions for guard updates, condition checks, and corresponding body execution if the condition matches.
-
Constructor Summary
ConstructorsConstructorDescriptionConditionCase(String caseScopeId, String caseType, List<IRInstr> guardUpdates, String bodyScopeId, String enumConstant, int enumOrdinal, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Creates an instance of aConditionCaserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebodyEvaluationrecord component.Returns the value of thebodyResultrecord component.Returns the value of thebodyScopeIdrecord component.Returns the value of thecaseScopeIdrecord component.caseType()Returns the value of thecaseTyperecord component.Returns the value of theconditionEvaluationrecord component.Returns the value of theconditionResultrecord component.static ConditionCasecreateEnumCase(String caseScopeId, String enumConstant, int enumOrdinal, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for enum constant comparison (switch enum cases).static ConditionCasecreateExpression(String caseScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for general boolean expressions (if statements).static ConditionCasecreateGuardCondition(String caseScopeId, List<IRInstr> guardUpdates, String bodyScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for guard conditions (if/switch with guards).static ConditionCasecreateLiteral(String caseScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for literal value comparison (switch literal cases).static ConditionCasecreateNullCheck(String caseScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for the Question operator null check.Returns the value of theenumConstantrecord component.intReturns the value of theenumOrdinalrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theguardUpdatesrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theprimitiveConditionrecord component.toString()IR-optimized toString following EK9's bracket-only, no-indentation format.
-
Constructor Details
-
ConditionCase
public ConditionCase(String caseScopeId, String caseType, List<IRInstr> guardUpdates, String bodyScopeId, String enumConstant, int enumOrdinal, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Creates an instance of aConditionCaserecord class.- Parameters:
caseScopeId- the value for thecaseScopeIdrecord componentcaseType- the value for thecaseTyperecord componentguardUpdates- the value for theguardUpdatesrecord componentbodyScopeId- the value for thebodyScopeIdrecord componentenumConstant- the value for theenumConstantrecord componentenumOrdinal- the value for theenumOrdinalrecord componentconditionEvaluation- the value for theconditionEvaluationrecord componentconditionResult- the value for theconditionResultrecord componentprimitiveCondition- the value for theprimitiveConditionrecord componentbodyEvaluation- the value for thebodyEvaluationrecord componentbodyResult- the value for thebodyResultrecord component
-
-
Method Details
-
createNullCheck
-
createExpression
-
createEnumCase
public static ConditionCase createEnumCase(String caseScopeId, String enumConstant, int enumOrdinal, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for enum constant comparison (switch enum cases). -
createLiteral
-
createGuardCondition
public static ConditionCase createGuardCondition(String caseScopeId, List<IRInstr> guardUpdates, String bodyScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult) Create a condition case for guard conditions (if/switch with guards). -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
caseScopeId
Returns the value of thecaseScopeIdrecord component.- Returns:
- the value of the
caseScopeIdrecord component
-
caseType
Returns the value of thecaseTyperecord component.- Returns:
- the value of the
caseTyperecord component
-
guardUpdates
-
bodyScopeId
Returns the value of thebodyScopeIdrecord component.- Returns:
- the value of the
bodyScopeIdrecord component
-
enumConstant
Returns the value of theenumConstantrecord component.- Returns:
- the value of the
enumConstantrecord component
-
enumOrdinal
public int enumOrdinal()Returns the value of theenumOrdinalrecord component.- Returns:
- the value of the
enumOrdinalrecord component
-
conditionEvaluation
-
conditionResult
Returns the value of theconditionResultrecord component.- Returns:
- the value of the
conditionResultrecord component
-
primitiveCondition
Returns the value of theprimitiveConditionrecord component.- Returns:
- the value of the
primitiveConditionrecord component
-
bodyEvaluation
-
bodyResult
Returns the value of thebodyResultrecord component.- Returns:
- the value of the
bodyResultrecord component
-