Record Class ASTStmtSwitch.SwitchCase

java.lang.Object
java.lang.Record
io.github.protasm.jvmud.compiler.parser.ast.stmt.ASTStmtSwitch.SwitchCase
Record Components:
expression - the exact case value or inclusive range start; null for default
rangeEndExpression - the inclusive range end for case start..end:, otherwise null
Enclosing class:
ASTStmtSwitch

public static record ASTStmtSwitch.SwitchCase(int line, ASTExpression expression, ASTExpression rangeEndExpression, boolean isDefault, List<ASTStatement> statements) extends Record
One case or default label and the statements owned by that label.
  • Constructor Details

    • SwitchCase

      public SwitchCase(int line, ASTExpression expression, ASTExpression rangeEndExpression, boolean isDefault, List<ASTStatement> statements)
      Creates an instance of a SwitchCase record class.
      Parameters:
      line - the value for the line record component
      expression - the value for the expression record component
      rangeEndExpression - the value for the rangeEndExpression record component
      isDefault - the value for the isDefault record component
      statements - the value for the statements record component
    • SwitchCase

      public SwitchCase(int line, ASTExpression expression, boolean isDefault, List<ASTStatement> statements)
  • Method Details

    • isRange

      public boolean isRange()
    • 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. 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.
    • line

      public int line()
      Returns the value of the line record component.
      Returns:
      the value of the line record component
    • expression

      public ASTExpression expression()
      Returns the value of the expression record component.
      Returns:
      the value of the expression record component
    • rangeEndExpression

      public ASTExpression rangeEndExpression()
      Returns the value of the rangeEndExpression record component.
      Returns:
      the value of the rangeEndExpression record component
    • isDefault

      public boolean isDefault()
      Returns the value of the isDefault record component.
      Returns:
      the value of the isDefault record component
    • statements

      public List<ASTStatement> statements()
      Returns the value of the statements record component.
      Returns:
      the value of the statements record component