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 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 a ConditionCase record class.
      Parameters:
      caseScopeId - the value for the caseScopeId record component
      caseType - the value for the caseType record component
      guardUpdates - the value for the guardUpdates record component
      bodyScopeId - the value for the bodyScopeId record component
      enumConstant - the value for the enumConstant record component
      enumOrdinal - the value for the enumOrdinal record component
      conditionEvaluation - the value for the conditionEvaluation record component
      conditionResult - the value for the conditionResult record component
      primitiveCondition - the value for the primitiveCondition record component
      bodyEvaluation - the value for the bodyEvaluation record component
      bodyResult - the value for the bodyResult record component
  • Method Details

    • createNullCheck

      public static ConditionCase createNullCheck(String caseScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult)
      Create a condition case for the Question operator null check.
    • createExpression

      public static ConditionCase createExpression(String caseScopeId, List<IRInstr> conditionEvaluation, String conditionResult, String primitiveCondition, List<IRInstr> bodyEvaluation, String bodyResult)
      Create a condition case for general boolean expressions (if statements).
    • 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

      public static ConditionCase createLiteral(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).
    • 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

      public String toString()
      IR-optimized toString following EK9's bracket-only, no-indentation format.
      Specified by:
      toString in class Record
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • caseScopeId

      public String caseScopeId()
      Returns the value of the caseScopeId record component.
      Returns:
      the value of the caseScopeId record component
    • caseType

      public String caseType()
      Returns the value of the caseType record component.
      Returns:
      the value of the caseType record component
    • guardUpdates

      public List<IRInstr> guardUpdates()
      Returns the value of the guardUpdates record component.
      Returns:
      the value of the guardUpdates record component
    • bodyScopeId

      public String bodyScopeId()
      Returns the value of the bodyScopeId record component.
      Returns:
      the value of the bodyScopeId record component
    • enumConstant

      public String enumConstant()
      Returns the value of the enumConstant record component.
      Returns:
      the value of the enumConstant record component
    • enumOrdinal

      public int enumOrdinal()
      Returns the value of the enumOrdinal record component.
      Returns:
      the value of the enumOrdinal record component
    • conditionEvaluation

      public List<IRInstr> conditionEvaluation()
      Returns the value of the conditionEvaluation record component.
      Returns:
      the value of the conditionEvaluation record component
    • conditionResult

      public String conditionResult()
      Returns the value of the conditionResult record component.
      Returns:
      the value of the conditionResult record component
    • primitiveCondition

      public String primitiveCondition()
      Returns the value of the primitiveCondition record component.
      Returns:
      the value of the primitiveCondition record component
    • bodyEvaluation

      public List<IRInstr> bodyEvaluation()
      Returns the value of the bodyEvaluation record component.
      Returns:
      the value of the bodyEvaluation record component
    • bodyResult

      public String bodyResult()
      Returns the value of the bodyResult record component.
      Returns:
      the value of the bodyResult record component