Record Class SwitchChainDetails

java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.SwitchChainDetails

public record SwitchChainDetails(String result, String chainType, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails) extends Record
Record containing all information needed to create a SWITCH_CHAIN_BLOCK instruction.

This record aggregates all the necessary data for generating the unified control flow IR, supporting all variants: Question operators, if/else statements, switch statements, and guarded assignments.

Used by SwitchChainBlockGenerator to coordinate the creation of SWITCH_CHAIN_BLOCK instructions with consistent memory management and optimization hints.

  • Constructor Details

    • SwitchChainDetails

      public SwitchChainDetails(String result, String chainType, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails)
      Creates an instance of a SwitchChainDetails record class.
      Parameters:
      result - the value for the result record component
      chainType - the value for the chainType record component
      evaluationVariable - the value for the evaluationVariable record component
      evaluationVariableType - the value for the evaluationVariableType record component
      evaluationVariableSetup - the value for the evaluationVariableSetup record component
      returnVariable - the value for the returnVariable record component
      returnVariableType - the value for the returnVariableType record component
      returnVariableSetup - the value for the returnVariableSetup record component
      conditionChain - the value for the conditionChain record component
      defaultBodyEvaluation - the value for the defaultBodyEvaluation record component
      defaultResult - the value for the defaultResult record component
      enumOptimizationInfo - the value for the enumOptimizationInfo record component
      basicDetails - the value for the basicDetails record component
  • Method Details

    • createQuestionOperator

      public static SwitchChainDetails createQuestionOperator(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for a Question operator (?).
    • createIfElse

      public static SwitchChainDetails createIfElse(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for an if/else statement.
    • createSwitchEnum

      public static SwitchChainDetails createSwitchEnum(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails)
      Create details for a switch statement with enum optimization.
    • createSwitch

      public static SwitchChainDetails createSwitch(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for a general switch statement.
    • hasEvaluationVariable

      public boolean hasEvaluationVariable()
      Check if this switch has an evaluation variable.
    • hasReturnVariable

      public boolean hasReturnVariable()
      Check if this switch has a return variable.
    • hasDefaultCase

      public boolean hasDefaultCase()
      Check if this switch has a default case.
    • hasEnumOptimization

      public boolean hasEnumOptimization()
      Check if this switch has enum optimization information.
    • getScopeId

      public String getScopeId()
      Get the scope ID from basic details.
    • isQuestionOperator

      public boolean isQuestionOperator()
      Check if this is a Question operator.
    • isIfElse

      public boolean isIfElse()
      Check if this is an if/else construct.
    • isSwitch

      public boolean isSwitch()
      Check if this is a switch construct.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • result

      public String result()
      Returns the value of the result record component.
      Returns:
      the value of the result record component
    • chainType

      public String chainType()
      Returns the value of the chainType record component.
      Returns:
      the value of the chainType record component
    • evaluationVariable

      public String evaluationVariable()
      Returns the value of the evaluationVariable record component.
      Returns:
      the value of the evaluationVariable record component
    • evaluationVariableType

      public String evaluationVariableType()
      Returns the value of the evaluationVariableType record component.
      Returns:
      the value of the evaluationVariableType record component
    • evaluationVariableSetup

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

      public String returnVariable()
      Returns the value of the returnVariable record component.
      Returns:
      the value of the returnVariable record component
    • returnVariableType

      public String returnVariableType()
      Returns the value of the returnVariableType record component.
      Returns:
      the value of the returnVariableType record component
    • returnVariableSetup

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

      public List<ConditionCase> conditionChain()
      Returns the value of the conditionChain record component.
      Returns:
      the value of the conditionChain record component
    • defaultBodyEvaluation

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

      public String defaultResult()
      Returns the value of the defaultResult record component.
      Returns:
      the value of the defaultResult record component
    • enumOptimizationInfo

      public EnumOptimizationInfo enumOptimizationInfo()
      Returns the value of the enumOptimizationInfo record component.
      Returns:
      the value of the enumOptimizationInfo record component
    • basicDetails

      public BasicDetails basicDetails()
      Returns the value of the basicDetails record component.
      Returns:
      the value of the basicDetails record component