Record Class LogicalOperationContext

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.support.LogicalOperationContext

public record LogicalOperationContext(IROpcode opcode, String result, LogicalOperationInstr.Operation operation) extends Record
Record to group logical operation context information.

This pattern centralizes operation metadata that defines the identity and result of a logical operation (AND/OR): - IROpcode: The specific IR operation code (LOGICAL_AND_BLOCK/LOGICAL_OR_BLOCK) - Result: The variable name that will hold the operation result - Operation: The logical operation type (AND/OR enum)

Provides a foundation for consistent operation context handling across logical operations and future similar constructs.

  • Constructor Details

    • LogicalOperationContext

      public LogicalOperationContext(IROpcode opcode, String result, LogicalOperationInstr.Operation operation)
      Creates an instance of a LogicalOperationContext record class.
      Parameters:
      opcode - the value for the opcode record component
      result - the value for the result record component
      operation - the value for the operation record component
  • Method Details

    • 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.
    • opcode

      public IROpcode opcode()
      Returns the value of the opcode record component.
      Returns:
      the value of the opcode record component
    • result

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

      public LogicalOperationInstr.Operation operation()
      Returns the value of the operation record component.
      Returns:
      the value of the operation record component